Class: AgentClient::Segment
- Inherits:
-
Object
- Object
- AgentClient::Segment
- Defined in:
- lib/agent_client/segment.rb
Overview
Represents a link in a Stratumn application
Instance Attribute Summary collapse
-
#link ⇒ Object
Returns the value of attribute link.
-
#link_hash ⇒ Object
Returns the value of attribute link_hash.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#process ⇒ Object
Returns the value of attribute process.
-
#references ⇒ Object
Returns the value of attribute references.
-
#state ⇒ Object
Returns the value of attribute state.
Class Method Summary collapse
Instance Method Summary collapse
- #find_segments(options = {}) ⇒ Object
-
#initialize(process, obj) ⇒ Segment
constructor
A new instance of Segment.
- #load ⇒ Object
- #previous ⇒ Object
Methods included from Helper
Methods included from Request
Constructor Details
#initialize(process, obj) ⇒ Segment
Returns a new instance of Segment.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/agent_client/segment.rb', line 24 def initialize(process, obj) self.process = process self.link = obj['link'] self. = link['meta'] self.state = link['state'] self.link_hash = obj['meta']['linkHash'] self.references = ['refs'] process.info['actions'].each do |(method, _)| add_transition_method(method) end end |
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
22 23 24 |
# File 'lib/agent_client/segment.rb', line 22 def link @link end |
#link_hash ⇒ Object
Returns the value of attribute link_hash.
22 23 24 |
# File 'lib/agent_client/segment.rb', line 22 def link_hash @link_hash end |
#meta ⇒ Object
Returns the value of attribute meta.
22 23 24 |
# File 'lib/agent_client/segment.rb', line 22 def @meta end |
#process ⇒ Object
Returns the value of attribute process.
22 23 24 |
# File 'lib/agent_client/segment.rb', line 22 def process @process end |
#references ⇒ Object
Returns the value of attribute references.
22 23 24 |
# File 'lib/agent_client/segment.rb', line 22 def references @references end |
#state ⇒ Object
Returns the value of attribute state.
22 23 24 |
# File 'lib/agent_client/segment.rb', line 22 def state @state end |
Class Method Details
Instance Method Details
#find_segments(options = {}) ⇒ Object
42 43 44 |
# File 'lib/agent_client/segment.rb', line 42 def find_segments( = {}) process.find_segments() end |
#load ⇒ Object
46 47 48 |
# File 'lib/agent_client/segment.rb', line 46 def load process.get_segment(link_hash) end |
#previous ⇒ Object
38 39 40 |
# File 'lib/agent_client/segment.rb', line 38 def previous process.get_segment(['prevLinkHash']) if ['prevLinkHash'] end |