Class: Moory::Transition::Shunter
- Inherits:
-
Struct
- Object
- Struct
- Moory::Transition::Shunter
- Defined in:
- lib/moory/transitions.rb
Instance Attribute Summary collapse
-
#effector ⇒ Object
Returns the value of attribute effector.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#output ⇒ Object
Returns the value of attribute output.
-
#settlement ⇒ Object
Returns the value of attribute settlement.
-
#stimulus ⇒ Object
Returns the value of attribute stimulus.
Instance Method Summary collapse
Instance Attribute Details
#effector ⇒ Object
Returns the value of attribute effector
44 45 46 |
# File 'lib/moory/transitions.rb', line 44 def effector @effector end |
#origin ⇒ Object
Returns the value of attribute origin
44 45 46 |
# File 'lib/moory/transitions.rb', line 44 def origin @origin end |
#output ⇒ Object
Returns the value of attribute output
44 45 46 |
# File 'lib/moory/transitions.rb', line 44 def output @output end |
#settlement ⇒ Object
Returns the value of attribute settlement
44 45 46 |
# File 'lib/moory/transitions.rb', line 44 def settlement @settlement end |
#stimulus ⇒ Object
Returns the value of attribute stimulus
44 45 46 |
# File 'lib/moory/transitions.rb', line 44 def stimulus @stimulus end |
Instance Method Details
#to_hash ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/moory/transitions.rb', line 57 def to_hash return {} unless valid? p = Pair.new(left: origin, right: stimulus) p.shunt({ settlement: settlement, output: output, effector: effector }.compact) end |
#valid? ⇒ Boolean
53 54 55 |
# File 'lib/moory/transitions.rb', line 53 def valid? origin && stimulus && settlement end |