module Deconstructable::ClassMethods

DSL methods made available to the including class:

Public Instance Methods

attr_deconstructable(*keys) click to toggle source

Sugar defining readable attributes (as per `attr_reader`) that are deconstructable

# File lib/deconstructable.rb, line 19
def attr_deconstructable(*keys)
  attr_reader(*keys)
  deconstructable(*keys)
end
deconstructable(*keys) click to toggle source

Method names that represent attributes that should be exposed in patterns

# File lib/deconstructable.rb, line 12
def deconstructable(*keys)
  @deconstructable ||= (superclass&.instance_variable_get(:@deconstructable)&.dup || [])
  @deconstructable.concat(keys)
end