Module: Deconstructable::ClassMethods
- Defined in:
- lib/deconstructable.rb
Overview
DSL methods made available to the including class:
Instance Method Summary collapse
-
#attr_deconstructable(*keys) ⇒ Object
Sugar defining readable attributes (as per
attr_reader) that are deconstructable. -
#deconstructable(*keys) ⇒ Object
Method names that represent attributes that should be exposed in patterns.
Instance Method Details
#attr_deconstructable(*keys) ⇒ Object
Sugar defining readable attributes (as per attr_reader) that are
deconstructable
19 20 21 22 |
# File 'lib/deconstructable.rb', line 19 def attr_deconstructable(*keys) attr_reader(*keys) deconstructable(*keys) end |
#deconstructable(*keys) ⇒ Object
Method names that represent attributes that should be exposed in patterns
12 13 14 15 |
# File 'lib/deconstructable.rb', line 12 def deconstructable(*keys) @deconstructable ||= (superclass&.instance_variable_get(:@deconstructable)&.dup || []) @deconstructable.concat(keys) end |