Class: Literal::Types::SetType

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

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ SetType

Returns a new instance of SetType.



2
3
4
# File 'lib/literal/types/set_type.rb', line 2

def initialize(type)
  @type = type
end

Instance Method Details

#===(value) ⇒ Object



10
11
12
# File 'lib/literal/types/set_type.rb', line 10

def ===(value)
  value.is_a?(::Set) && value.all? { |item| @type === item }
end

#inspectObject



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

def inspect
  "Set(#{@type.inspect})"
end