Class: Pathway::State

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pathway.rb

Instance Method Summary collapse

Constructor Details

#initialize(operation, values = {}) ⇒ State

Returns a new instance of State.



56
57
58
59
# File 'lib/pathway.rb', line 56

def initialize(operation, values = {})
  @hash = operation.context.merge(values)
  @result_key = operation.result_key
end

Instance Method Details

#resultObject



68
69
70
# File 'lib/pathway.rb', line 68

def result
  @hash[@result_key]
end

#to_hashObject Also known as: to_h



72
73
74
# File 'lib/pathway.rb', line 72

def to_hash
  @hash
end

#update(kargs) ⇒ Object



63
64
65
66
# File 'lib/pathway.rb', line 63

def update(kargs)
  @hash.update(kargs)
  self
end