Class: ObjectForge::Molds::WrappedMold
- Inherits:
-
Object
- Object
- ObjectForge::Molds::WrappedMold
- Defined in:
- lib/object_forge/molds/wrapped_mold.rb
Overview
Mold that wraps a mold class.
Wrapping a mold class is useful when its #call is stateful, making it unsafe to use multiple times or in shared environments.
Instance Attribute Summary collapse
-
#wrapped_mold ⇒ Class
readonly
Wrapped mold class.
Instance Method Summary collapse
-
#call(...) ⇒ Any
Instantiate #wrapped_mold and call it.
-
#initialize(wrapped_mold) ⇒ WrappedMold
constructor
A new instance of WrappedMold.
Constructor Details
#initialize(wrapped_mold) ⇒ WrappedMold
Returns a new instance of WrappedMold.
17 18 19 |
# File 'lib/object_forge/molds/wrapped_mold.rb', line 17 def initialize(wrapped_mold) @wrapped_mold = wrapped_mold end |
Instance Attribute Details
#wrapped_mold ⇒ Class (readonly)
Returns wrapped mold class.
14 15 16 |
# File 'lib/object_forge/molds/wrapped_mold.rb', line 14 def wrapped_mold @wrapped_mold end |
Instance Method Details
#call(...) ⇒ Any
Instantiate #wrapped_mold and call it.
25 26 27 |
# File 'lib/object_forge/molds/wrapped_mold.rb', line 25 def call(...) wrapped_mold.new.call(...) end |