Module: Gearhead::Extensions::Attributes
- Included in:
- Gear
- Defined in:
- lib/gearhead/extensions/attributes.rb
Class Method Summary collapse
Instance Method Summary collapse
- #_gear_attributes ⇒ Object
- #attribute(name, &block) ⇒ Object
- #attributes(*attrs) ⇒ Object
- #default_attributes ⇒ Object
Class Method Details
.included(klass) ⇒ Object
4 5 6 |
# File 'lib/gearhead/extensions/attributes.rb', line 4 def self.included(klass) klass.define_gear_setting :custom_attributes, [] end |
Instance Method Details
#_gear_attributes ⇒ Object
8 9 10 |
# File 'lib/gearhead/extensions/attributes.rb', line 8 def _gear_attributes @_gear_attributes end |
#attribute(name, &block) ⇒ Object
20 21 22 |
# File 'lib/gearhead/extensions/attributes.rb', line 20 def attribute(name, &block) @_gear_custom_attributes << [name, block] end |
#attributes(*attrs) ⇒ Object
12 13 14 |
# File 'lib/gearhead/extensions/attributes.rb', line 12 def attributes(*attrs) @_gear_attributes = *attrs end |
#default_attributes ⇒ Object
16 17 18 |
# File 'lib/gearhead/extensions/attributes.rb', line 16 def default_attributes @resource.columns_hash.keys.map(&:to_sym) end |