Class: MODL::Model::Modl
- Inherits:
-
Object
- Object
- MODL::Model::Modl
- Defined in:
- lib/modl/model/model.rb
Overview
The root of a MODL object
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Modl
constructor
A new instance of Modl.
- #to_j ⇒ Object
- #to_m ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ Modl
Returns a new instance of Modl.
10 11 12 |
# File 'lib/modl/model/model.rb', line 10 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/modl/model/model.rb', line 8 def value @value end |
Instance Method Details
#to_j ⇒ Object
22 23 24 |
# File 'lib/modl/model/model.rb', line 22 def to_j @value.nil? ? 'null' : @value.to_j end |
#to_m ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/modl/model/model.rb', line 26 def to_m if @value.instance_of?(ModlMap) @value.items.map(&:to_m).join(';') else @value.to_m end end |
#to_s ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/modl/model/model.rb', line 14 def to_s if @value.instance_of? Array @value.map(&:to_s) else "Modl: #{@value}" end end |