Class: SonJay::ModelArray
- Inherits:
-
Object
- Object
- SonJay::ModelArray
- Extended by:
- Forwardable
- Includes:
- ActsAsModel
- Defined in:
- lib/son_jay/model_array.rb
Class Attribute Summary collapse
-
.entry_class ⇒ Object
Returns the value of attribute entry_class.
Instance Method Summary collapse
- #additional ⇒ Object
-
#initialize ⇒ ModelArray
constructor
A new instance of ModelArray.
- #load_data(data) ⇒ Object
- #sonj_content ⇒ Object
Methods included from ActsAsModel
Constructor Details
#initialize ⇒ ModelArray
Returns a new instance of ModelArray.
20 21 22 |
# File 'lib/son_jay/model_array.rb', line 20 def initialize @entries = [] end |
Class Attribute Details
.entry_class ⇒ Object
Returns the value of attribute entry_class.
16 17 18 |
# File 'lib/son_jay/model_array.rb', line 16 def entry_class @entry_class end |
Instance Method Details
#additional ⇒ Object
28 29 30 31 32 |
# File 'lib/son_jay/model_array.rb', line 28 def additional entry = self.class.entry_class.new @entries << entry entry end |
#load_data(data) ⇒ Object
34 35 36 37 38 |
# File 'lib/son_jay/model_array.rb', line 34 def load_data(data) data.each do |entry_data| additional.sonj_content.load_data entry_data end end |
#sonj_content ⇒ Object
24 25 26 |
# File 'lib/son_jay/model_array.rb', line 24 def sonj_content self end |