class RSpec::Contracts::Fulfillment

Attributes

interface_fulfillments[R]

Public Class Methods

new(interfaces, implementors) click to toggle source
# File lib/rspec/contracts/fulfillment.rb, line 8
def initialize(interfaces, implementors)
  @implementors = implementors
  @interface_fulfillments = interfaces.map do |interface|
    InterfaceFulfillment.new interface, implementors_for(interface)
  end
end

Public Instance Methods

complete?() click to toggle source
# File lib/rspec/contracts/fulfillment.rb, line 15
def complete?
  incomplete_interfaces.empty?
end
implementors_for(interface) click to toggle source
# File lib/rspec/contracts/fulfillment.rb, line 27
def implementors_for(interface)
  @implementors.select{ |i| i.interface_names.include? interface.name }
end
incomplete_interfaces() click to toggle source
# File lib/rspec/contracts/fulfillment.rb, line 19
def incomplete_interfaces
  interface_fulfillments.reject(&:complete?)
end
messages_count() click to toggle source
# File lib/rspec/contracts/fulfillment.rb, line 23
def messages_count
  interface_fulfillments.map(&:messages_count).inject(&:+) || 0
end