Module: Glamazon::Base
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from JSON
#encoder, #to_json
Methods included from Attributes
#[], #[]=, #attributes, #method_missing, #read_attribute, #to_s, #write_attribute
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Glamazon::Attributes
Instance Method Details
#initialize(attributes = {}) ⇒ Object
6
7
8
9
|
# File 'lib/glamazon/base.rb', line 6
def initialize(attributes = {})
self.id = SecureRandom.uuid
attributes.each { |k,v| send "#{k}=", v }
end
|
#save ⇒ Object
11
12
13
|
# File 'lib/glamazon/base.rb', line 11
def save
self.class.all << self
end
|
#touch ⇒ Object
15
16
17
|
# File 'lib/glamazon/base.rb', line 15
def touch
self[:updated_at] = Time.now.getutc
end
|