Class: Wolflow::Operators::Attribute

Inherits:
Base
  • Object
show all
Defined in:
lib/wolflow/operators/attribute.rb

Instance Method Summary collapse

Methods inherited from Base

from_hash, inherited

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_hashObject



15
16
17
18
19
# File 'lib/wolflow/operators/attribute.rb', line 15

def to_hash
  hs = super
  hs[:name] = @name
  hs
end