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.



52
53
54
55
# File 'lib/pathway.rb', line 52

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

Instance Method Details

#resultObject



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

def result
  @hash[@result_key]
end

#to_hashObject Also known as: to_h



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

def to_hash
  @hash
end

#update(kargs) ⇒ Object



59
60
61
62
# File 'lib/pathway.rb', line 59

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