Class: AASMMermaid::Transition
- Inherits:
-
Object
- Object
- AASMMermaid::Transition
- Defined in:
- lib/aasm_mermaid/transition.rb
Overview
Represents a diagram transition row
Instance Attribute Summary collapse
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
True if given objet is equal, false otherwise.
-
#initialize(from:, to:, event_name:) ⇒ Transition
constructor
A new instance of Transition.
-
#to_diagram_string ⇒ String
Mermaid diagram string.
Constructor Details
#initialize(from:, to:, event_name:) ⇒ Transition
Returns a new instance of Transition.
12 13 14 15 16 |
# File 'lib/aasm_mermaid/transition.rb', line 12 def initialize(from:, to:, event_name:) self.from = from self.to = to self.event_name = event_name end |
Instance Attribute Details
#event_name ⇒ Object
Returns the value of attribute event_name.
7 8 9 |
# File 'lib/aasm_mermaid/transition.rb', line 7 def event_name @event_name end |
#from ⇒ Object
Returns the value of attribute from.
7 8 9 |
# File 'lib/aasm_mermaid/transition.rb', line 7 def from @from end |
#to ⇒ Object
Returns the value of attribute to.
7 8 9 |
# File 'lib/aasm_mermaid/transition.rb', line 7 def to @to end |
Instance Method Details
#==(other) ⇒ true, false
Returns true if given objet is equal, false otherwise.
19 20 21 |
# File 'lib/aasm_mermaid/transition.rb', line 19 def ==(other) from.to_s == other.from.to_s && to.to_s == other.to.to_s && event_name == other.event_name end |
#to_diagram_string ⇒ String
Returns mermaid diagram string.
24 25 26 |
# File 'lib/aasm_mermaid/transition.rb', line 24 def to_diagram_string " #{from} --> #{to} : #{event_name}" end |