Class: ObjectForge::Forge::Parameters

Inherits:
Struct
  • Object
show all
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.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Attribute Details

#attributesHash{Symbol => Proc, Any} (readonly)

Default values of the attributes.

Returns:

  • (Hash{Symbol => Proc, Any})


40
# File 'lib/object_forge/forge.rb', line 40

Parameters = Struct.new(:attributes, :traits, :options, keyword_init: true)

#optionsHash{Symbol => Any} (readonly)

A forge’s options. Known options:

  • :mold — a callable object that knows how to build the instance, taking a class and a hash of attributes.

  • :crucible — a callable object that knows how to resolve attributes, taking a hash of initial attributes.

  • :after_forge/:after_build — a callable object that is passed the forged instance and can do anything with it.

Returns:

  • (Hash{Symbol => Any})

Since:

  • 0.3.0



40
# File 'lib/object_forge/forge.rb', line 40

Parameters = Struct.new(:attributes, :traits, :options, keyword_init: true)

#traitsHash{Symbol => Hash{Symbol => Proc, Any}} (readonly)

Attributes belonging to traits.

Returns:

  • (Hash{Symbol => Hash{Symbol => Proc, Any}})


40
# File 'lib/object_forge/forge.rb', line 40

Parameters = Struct.new(:attributes, :traits, :options, keyword_init: true)