Class: T::NilableType
- Inherits:
-
Object
- Object
- T::NilableType
- Defined in:
- lib/emery/type.rb
Instance Attribute Summary collapse
-
#inner_type ⇒ Object
readonly
Returns the value of attribute inner_type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #check(value) ⇒ Object
-
#initialize(inner_type) ⇒ NilableType
constructor
A new instance of NilableType.
- #to_s ⇒ Object
Constructor Details
#initialize(inner_type) ⇒ NilableType
Returns a new instance of NilableType.
21 22 23 |
# File 'lib/emery/type.rb', line 21 def initialize(inner_type) @inner_type = inner_type end |
Instance Attribute Details
#inner_type ⇒ Object (readonly)
Returns the value of attribute inner_type.
20 21 22 |
# File 'lib/emery/type.rb', line 20 def inner_type @inner_type end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 |
# File 'lib/emery/type.rb', line 32 def ==(other) T.instance_of?(NilableType, other) and self.inner_type == other.inner_type end |
#check(value) ⇒ Object
27 28 29 30 31 |
# File 'lib/emery/type.rb', line 27 def check(value) if value != nil T.check(inner_type, value) end end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/emery/type.rb', line 24 def to_s "Nilable[#{inner_type.to_s}]" end |