Class: Literal::Types::InterfaceType
- Inherits:
-
Object
- Object
- Literal::Types::InterfaceType
- Defined in:
- lib/literal/types/interface_type.rb
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#initialize(*methods) ⇒ InterfaceType
constructor
A new instance of InterfaceType.
- #inspect ⇒ Object
Constructor Details
#initialize(*methods) ⇒ InterfaceType
Returns a new instance of InterfaceType.
2 3 4 |
# File 'lib/literal/types/interface_type.rb', line 2 def initialize(*methods) @methods = methods end |
Instance Method Details
#===(other) ⇒ Object
10 11 12 |
# File 'lib/literal/types/interface_type.rb', line 10 def ===(other) @methods.all? { |method| other.respond_to?(method) } end |
#inspect ⇒ Object
6 7 8 |
# File 'lib/literal/types/interface_type.rb', line 6 def inspect "Interface(#{@methods.map(&:inspect).join(", ")})" end |