Class: Wolflow::Operators::Attribute
- Defined in:
- lib/wolflow/operators/attribute.rb
Instance Method Summary collapse
- #call(task) ⇒ Object
-
#initialize(name:, **args) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_hash ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name:, **args) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 |
# File 'lib/wolflow/operators/attribute.rb', line 6 def initialize(name:, **args) @name = name super(**args) end |
Instance Method Details
#call(task) ⇒ Object
11 12 13 |
# File 'lib/wolflow/operators/attribute.rb', line 11 def call(task) task.data.fetch(@name) end |
#to_hash ⇒ Object
15 16 17 18 19 |
# File 'lib/wolflow/operators/attribute.rb', line 15 def to_hash hs = super hs[:name] = @name hs end |