Class: RailsFlowMap::FlowEdge
- Inherits:
-
Object
- Object
- RailsFlowMap::FlowEdge
- Defined in:
- lib/rails_flow_map/models/flow_edge.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#from ⇒ Object
Returns the value of attribute from.
-
#label ⇒ Object
Returns the value of attribute label.
-
#to ⇒ Object
Returns the value of attribute to.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #action_flow? ⇒ Boolean
- #association? ⇒ Boolean
-
#initialize(from:, to:, type:, label: nil, attributes: {}) ⇒ FlowEdge
constructor
A new instance of FlowEdge.
- #to_h ⇒ Object
Constructor Details
#initialize(from:, to:, type:, label: nil, attributes: {}) ⇒ FlowEdge
Returns a new instance of FlowEdge.
5 6 7 8 9 10 11 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 5 def initialize(from:, to:, type:, label: nil, attributes: {}) @from = from @to = to @type = type @label = label @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 3 def attributes @attributes end |
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 3 def from @from end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 3 def label @label end |
#to ⇒ Object
Returns the value of attribute to.
3 4 5 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 3 def to @to end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 3 def type @type end |
Instance Method Details
#action_flow? ⇒ Boolean
17 18 19 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 17 def action_flow? type == :action_flow end |
#association? ⇒ Boolean
13 14 15 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 13 def association? [:belongs_to, :has_one, :has_many, :has_and_belongs_to_many].include?(type) end |
#to_h ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/rails_flow_map/models/flow_edge.rb', line 21 def to_h { from: from, to: to, type: type, label: label, attributes: attributes } end |