Module: DocumentMapper::AttributeMethods::Read::ClassMethods
- Defined in:
- lib/document_mapper/attribute_methods.rb
Overview
included do
# Undefine id so it can be used as an attribute name
undef_method(:id) if method_defined?(:id)
end
Instance Method Summary collapse
Instance Method Details
#define_read_method(attr_name) ⇒ Object
12 13 14 15 |
# File 'lib/document_mapper/attribute_methods.rb', line 12 def define_read_method(attr_name) access_code = "attributes[:#{attr_name}]" generated_attribute_methods.module_eval("def #{attr_name}; #{access_code}; end", __FILE__, __LINE__) end |