Module: LB::Persistence::Model::Attributes
- Defined in:
- lib/lb/persistence/model/attributes.rb
Overview
Helper for dry-struct attributes
Instance Method Summary collapse
Instance Method Details
#delete_attribute(name) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/lb/persistence/model/attributes.rb', line 8 def delete_attribute(name) @schema.delete(name) equalizer.instance_variable_get('@keys').delete(name) superclass.instance_variable_get('@schema').delete(name) @constructor = Dry::Types['coercible.hash'] .public_send(constructor_type, @schema) self end |
#redefine_attribute(name, type) ⇒ Object
18 19 20 21 |
# File 'lib/lb/persistence/model/attributes.rb', line 18 def redefine_attribute(name, type) delete_attribute(name) attribute(name, type) end |