Class: Factrey::Ref::Defer
- Inherits:
-
Object
- Object
- Factrey::Ref::Defer
- Defined in:
- lib/factrey/ref/defer.rb
Overview
A thin wrapper around Proc to represent the procedure using the results of the reference resolution. Each argument name is considered as a reference. These references are resolved and the results are passed to the Proc.
Factrey::Refs and Defers are usually created through ShorthandMethods#ref.
Instance Attribute Summary collapse
- #body ⇒ Proc readonly
Instance Method Summary collapse
-
#initialize(&body) ⇒ Defer
constructor
A new instance of Defer.
- #refs ⇒ Array<Ref>
Constructor Details
#initialize(&body) ⇒ Defer
Returns a new instance of Defer.
19 20 21 22 23 24 |
# File 'lib/factrey/ref/defer.rb', line 19 def initialize(&body) body.parameters.all? { _1[0] == :req || _1[0] == :opt } or raise ArgumentError, "block must take only fixed positional arguments" @body = body end |
Instance Attribute Details
#body ⇒ Proc (readonly)
12 13 14 |
# File 'lib/factrey/ref/defer.rb', line 12 def body @body end |