Class: Literal::Types::SetType
- Inherits:
-
Object
- Object
- Literal::Types::SetType
- Defined in:
- lib/literal/types/set_type.rb
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(type) ⇒ SetType
constructor
A new instance of SetType.
- #inspect ⇒ Object
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 |
#inspect ⇒ Object
6 7 8 |
# File 'lib/literal/types/set_type.rb', line 6 def inspect "Set(#{@type.inspect})" end |