Method: Medea::JasonObject#method_missing
- Defined in:
- lib/medea/jasonobject.rb
#method_missing(name, *args, &block) ⇒ Object
The “Magic” component of candy (github.com/SFEley/candy), repurposed to make this a “weak object” that can take any attribute. Assigning any attribute will add it to the object’s hash (and then be POSTed to JasonDB on the next save)
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/medea/jasonobject.rb', line 87 def method_missing(name, *args, &block) load_from_jasondb if @__jason_state == :ghost field = name.to_s if field =~ /(.*)=$/ # We're assigning self[$1] = args[0] elsif field =~ /(.*)\?$/ # We're asking (self[$1] ? true : false) else self[field] end end |