Class: MODL::Model::ModlArray
- Inherits:
-
Object
- Object
- MODL::Model::ModlArray
- Defined in:
- lib/modl/model/model.rb
Overview
A MODL Array
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(items) ⇒ ModlArray
constructor
A new instance of ModlArray.
- #to_j ⇒ Object
- #to_m ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(items) ⇒ ModlArray
Returns a new instance of ModlArray.
39 40 41 |
# File 'lib/modl/model/model.rb', line 39 def initialize(items) @items = items end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
37 38 39 |
# File 'lib/modl/model/model.rb', line 37 def items @items end |
Instance Method Details
#to_j ⇒ Object
48 49 50 |
# File 'lib/modl/model/model.rb', line 48 def to_j @items.map(&:to_j) end |
#to_m ⇒ Object
52 53 54 55 |
# File 'lib/modl/model/model.rb', line 52 def to_m list = @items.map(&:to_m).join ';' "[#{list}]" end |
#to_s ⇒ Object
43 44 45 46 |
# File 'lib/modl/model/model.rb', line 43 def to_s items = @items.map(&:to_s) "ModlArray: #{items}" end |