Class: Height::Model::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/height/model/base.rb

Direct Known Subclasses

List, Task

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Base

Returns a new instance of Base.



3
4
5
6
7
8
9
10
# File 'lib/height/model/base.rb', line 3

def initialize(attrs)
  self.attributes.each do |key|
    self.instance_variable_set("@#{key}", attrs[key.to_s])
    define_singleton_method(key) do
      self.instance_variable_get("@#{key}")
    end
  end
end