Class: Literal::Types::InterfaceType

Inherits:
Object
  • Object
show all
Defined in:
lib/literal/types/interface_type.rb

Instance Method Summary collapse

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

#inspectObject



6
7
8
# File 'lib/literal/types/interface_type.rb', line 6

def inspect
  "Interface(#{@methods.map(&:inspect).join(", ")})"
end