Class: Attrocity::Model

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Model

Returns a new instance of Model.



3
4
5
6
7
8
# File 'lib/attrocity/model.rb', line 3

def initialize(attributes)
  attributes.each do |k,v|
    self.define_singleton_method(k) { v }
    self.define_singleton_method("#{k}?") { !!v }
  end
end