Class: ObjectForge::Forge::Parameters
- Inherits:
-
Struct
- Object
- Struct
- ObjectForge::Forge::Parameters
- Defined in:
- lib/object_forge/forge.rb
Overview
Interface for forge parameters. It is not used internally, but can be useful for defining forges through means other than ObjectForge::ForgeDSL.
Instance Attribute Summary collapse
-
#attributes ⇒ Hash{Symbol => Proc, Any}
readonly
Default values of the attributes.
-
#options ⇒ Hash{Symbol => Any}
readonly
A forge’s options.
-
#traits ⇒ Hash{Symbol => Hash{Symbol => Proc, Any}}
readonly
Attributes belonging to traits.
Instance Attribute Details
#attributes ⇒ Hash{Symbol => Proc, Any} (readonly)
Default values of the attributes.
42 |
# File 'lib/object_forge/forge.rb', line 42 Parameters = Struct.new(:attributes, :traits, :options, keyword_init: true) |
#options ⇒ Hash{Symbol => Any} (readonly)
A forge’s options. Known options:
-
:crucible— a callable object that knows how to resolve attributes, taking a hash of initial attributes and possibly a yard (see Crucible). -
:attribute_list— an array of attribute names to filter and sort by before passing attributes to the mold. -
:mold— a callable object that knows how to build the instance, taking a class and a hash of attributes (see Molds). -
:after_forge/:after_build— a callable object that is passed the forged instance and can do anything with it.
42 |
# File 'lib/object_forge/forge.rb', line 42 Parameters = Struct.new(:attributes, :traits, :options, keyword_init: true) |
#traits ⇒ Hash{Symbol => Hash{Symbol => Proc, Any}} (readonly)
Attributes belonging to traits.
42 |
# File 'lib/object_forge/forge.rb', line 42 Parameters = Struct.new(:attributes, :traits, :options, keyword_init: true) |