Module: Netzke::Basepack::Attributes::ClassMethods
- Defined in:
- lib/netzke/basepack/attributes.rb
Instance Method Summary collapse
-
#attribute(name, &block) ⇒ Object
Adds/overrides an attribute config, e.g.:.
Instance Method Details
#attribute(name, &block) ⇒ Object
Adds/overrides an attribute config, e.g.:
attribute :price do |c|
c.read_only = true
end
170 171 172 173 174 175 176 |
# File 'lib/netzke/basepack/attributes.rb', line 170 def attribute(name, &block) method_name = ATTRIBUTE_METHOD_NAME % name define_method(method_name, &block) # we *must* use a writer here self.declared_attribute_names = declared_attribute_names + [name] end |