Module: Village::Attributes
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object (private)
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/village/attributes.rb', line 8 def method_missing(method, *args) if @attributes.include?(method) @attributes[method] elsif method =~ /(.*)\=/ and !args.empty? @attributes[$1] = args.first elsif method =~ /(.*)\?/ @attributes[$1].present? else super end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/village/attributes.rb', line 4 def attributes @attributes end |