Class: ObjectForge::Molds::KeywordsMold

Inherits:
Object
  • Object
show all
Defined in:
lib/object_forge/molds/keywords_mold.rb

Overview

Basic mold which calls forged.new(**attributes).

Can be used instead of SingleArgumentMold, but performance is about 1.5 times worse.

Since:

  • 0.2.0

Instance Method Summary collapse

Instance Method Details

#call(forged:, attributes:, **_) ⇒ Any

Instantiate forged with a hash of attributes.

Parameters:

  • forged (Class, #new)
  • attributes (Hash{Symbol => Any})

Returns:

  • (Any)

Since:

  • 0.2.0



18
19
20
# File 'lib/object_forge/molds/keywords_mold.rb', line 18

def call(forged:, attributes:, **_)
  forged.new(**attributes)
end