Module: Shale::Builder::AssignedAttributes::ClassMethods
- Extended by:
- T::Sig
- Defined in:
- lib/shale/builder/assigned_attributes.rb
Overview
@requires_ancestor: singleton(Shale::Mapper)
Instance Attribute Summary collapse
-
#assigned_attributes_methods_module ⇒ Object
readonly
Contains overridden getter methods for attributes with complex types (so that they accept a block for building) : Module.
Instance Method Summary collapse
-
#attribute(name, shale_mapper, collection: false, default: nil, **kwargs, &block) ⇒ Object
: ( | String | Symbol name, | Class shale_mapper, | ?collection: bool, | ?default: Proc?, | **Object kwargs | ) ?{ -> void } -> void.
-
#inherited(subclass) ⇒ Object
: (Class subclass) -> void.
Instance Attribute Details
#assigned_attributes_methods_module ⇒ Object (readonly)
Contains overridden getter methods for attributes with complex types (so that they accept a block for building) : Module
50 51 52 |
# File 'lib/shale/builder/assigned_attributes.rb', line 50 def assigned_attributes_methods_module @assigned_attributes_methods_module end |
Instance Method Details
#attribute(name, shale_mapper, collection: false, default: nil, **kwargs, &block) ⇒ Object
: ( | String | Symbol name, | Class shale_mapper, | ?collection: bool, | ?default: Proc?, | **Object kwargs | ) ?{ -> void } -> void
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/shale/builder/assigned_attributes.rb', line 59 def attribute( name, shale_mapper, collection: false, default: nil, **kwargs, &block ) super @assigned_attributes_methods_module.class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{name}=(val) super return unless @__initialized self.assigned_attribute_names << #{name.to_sym.inspect} end RUBY end |
#inherited(subclass) ⇒ Object
: (Class subclass) -> void
42 43 44 45 |
# File 'lib/shale/builder/assigned_attributes.rb', line 42 def inherited(subclass) super AssignedAttributes.prepare_mod(subclass) end |