Class: RSpec::Contracts::InterfaceFulfillment

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/contracts/interface_fulfillment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interface, implementors) ⇒ InterfaceFulfillment

Returns a new instance of InterfaceFulfillment.



6
7
8
9
# File 'lib/rspec/contracts/interface_fulfillment.rb', line 6

def initialize(interface, implementors)
  @interface = interface
  @implementors = implementors
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



4
5
6
# File 'lib/rspec/contracts/interface_fulfillment.rb', line 4

def interface
  @interface
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/rspec/contracts/interface_fulfillment.rb', line 11

def complete?
  unfulfilled_messages.empty?
end

#messages_countObject



19
20
21
# File 'lib/rspec/contracts/interface_fulfillment.rb', line 19

def messages_count
  interface.unique_messages.count
end

#unfulfilled_messagesObject



15
16
17
# File 'lib/rspec/contracts/interface_fulfillment.rb', line 15

def unfulfilled_messages
  interface.unique_messages.reject{ |r| fulfilled? r }
end