Class: Nl::DataTypes::Scalar
- Inherits:
-
Base
- Object
- Base
- Nl::DataTypes::Scalar
show all
- Defined in:
- nl/lib/nl/datatypes.rb
Instance Method Summary
collapse
Methods inherited from Base
#coerce, #nlattr_type_flags
Constructor Details
#initialize(type, check:) ⇒ Scalar
Returns a new instance of Scalar.
34
35
36
37
|
# File 'nl/lib/nl/datatypes.rb', line 34
def initialize(type, check:)
super(check:)
@type = type
end
|
Instance Method Details
#decode(decoder, context: nil, nlattr_type_flags: 0) ⇒ Object
43
44
45
|
# File 'nl/lib/nl/datatypes.rb', line 43
def decode(decoder, context: nil, nlattr_type_flags: 0)
checked(decoder.get_value(@type))
end
|
#encode(encoder, value, context: nil) ⇒ Object
39
40
41
|
# File 'nl/lib/nl/datatypes.rb', line 39
def encode(encoder, value, context: nil)
encoder.put_value(@type, checked(value || 0))
end
|