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.



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

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

Instance Method Details

#resultObject



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

def result
  @hash[@result_key]
end

#to_hashObject Also known as: to_h



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

def to_hash
  @hash
end

#update(kargs) ⇒ Object



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

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