Module: Wolflow::Operators

Defined in:
lib/wolflow/operators/base.rb,
lib/wolflow/operators/literal.rb,
lib/wolflow/operators/attribute.rb,
lib/wolflow/operators/operation.rb

Defined Under Namespace

Classes: Attribute, Base, Literal, Operation

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.op_typesObject (readonly)

Returns the value of attribute op_types.



8
9
10
# File 'lib/wolflow/operators/base.rb', line 8

def op_types
  @op_types
end

Class Method Details

.from_hash(hash) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/wolflow/operators/base.rb', line 10

def from_hash(hash)
  case hash
  in { type: String => type, **args }
    operator_class = Operators.op_types.fetch(type)
    args = operator_class.from_hash(args)
    operator_class.new(**args)
  else
    raise TaskSpecError, "can't deserialize #{hash} to an operator"
  end
end