Class: Mal::EitherT
Instance Attribute Summary collapse
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(*types) ⇒ EitherT
constructor
A new instance of EitherT.
- #inspect ⇒ Object
- #|(another) ⇒ Object
Methods inherited from OnlyT
Constructor Details
#initialize(*types) ⇒ EitherT
Returns a new instance of EitherT.
218 219 220 |
# File 'lib/mal.rb', line 218 def initialize(*types) @types = types end |
Instance Attribute Details
#types ⇒ Object (readonly)
Returns the value of attribute types.
217 218 219 |
# File 'lib/mal.rb', line 217 def types @types end |
Instance Method Details
#===(value) ⇒ Object
222 223 224 |
# File 'lib/mal.rb', line 222 def ===(value) @types.any? {|type| type === value } end |
#inspect ⇒ Object
226 227 228 |
# File 'lib/mal.rb', line 226 def inspect 'Either(%s)' % @types.map{|e| e.inspect }.join(', ') end |