Module: Edr::Model

Defined in:
lib/edr/model.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_dataObject



23
24
25
# File 'lib/edr/model.rb', line 23

def _data
  @_data ||= self.class._new_instance
end

Class Method Details

.included(base) ⇒ Object



6
7
8
9
# File 'lib/edr/model.rb', line 6

def self.included(base)
  base.extend ClassMethods
  base.extend ::Forwardable
end

Instance Method Details

#as_json(options = {}) ⇒ Object



19
20
21
# File 'lib/edr/model.rb', line 19

def as_json(options={})
  _data.as_json(options)
end

#mass_assign(attributes) ⇒ Object



13
14
15
16
17
# File 'lib/edr/model.rb', line 13

def mass_assign(attributes)
  attributes.each do |k, v|
    self.send "#{k}=", v
  end
end