Module: Mongomatic::Plugins::Accessors::ClassMethods
- Defined in:
- lib/matic_accessor.rb
Instance Method Summary collapse
- #matic_accessor(*attributes) ⇒ Object
- #matic_reader(*attributes) ⇒ Object
- #matic_writer(*attributes) ⇒ Object
Instance Method Details
#matic_accessor(*attributes) ⇒ Object
8 9 10 11 |
# File 'lib/matic_accessor.rb', line 8 def matic_accessor(*attributes) matic_reader(*attributes) matic_writer(*attributes) end |
#matic_reader(*attributes) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/matic_accessor.rb', line 12 def matic_reader(*attributes) attributes.each do |attribute| define_method(:"#{attribute}") do self[attribute] end end end |
#matic_writer(*attributes) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/matic_accessor.rb', line 19 def matic_writer(*attributes) attributes.each do |attribute| define_method(:"#{attribute}=") do |value| self[attribute] = value end end end |