Class: Accord::Declarations::Declaration

Inherits:
Specification show all
Defined in:
lib/accord/declarations.rb

Direct Known Subclasses

Implements

Instance Method Summary collapse

Methods inherited from Specification

#ancestors, #bases, #bases=, #each_interface, #initialize, #inspect, #interfaces

Constructor Details

This class inherits a constructor from Accord::Specification

Instance Method Details

#+(other) ⇒ Object



10
11
12
# File 'lib/accord/declarations.rb', line 10

def + other
  Declaration.new(interfaces + other.interfaces)
end

#-(other) ⇒ Object



14
15
16
17
18
# File 'lib/accord/declarations.rb', line 14

def - other
  Declaration.new(interfaces.select { |i|
    !other.interfaces.any? { |j| i.extends?(j) }
  })
end

#extends?(interface) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/accord/declarations.rb', line 6

def extends?(interface)
  super(interface) && interfaces.include?(interface)
end