Class: SonJay::ModelArray

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ActsAsModel
Defined in:
lib/son_jay/model_array.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActsAsModel

included

Constructor Details

#initializeModelArray

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_classObject

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

#additionalObject



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_contentObject



24
25
26
# File 'lib/son_jay/model_array.rb', line 24

def sonj_content
  self
end