Class: SportsManager::SolutionDrawer::Mermaid::Node
- Extended by:
- Forwardable
- Defined in:
- lib/sports_manager/solution_drawer/mermaid/node.rb
Constant Summary collapse
- TIME_TEMPLATE =
'%d/%m %H:%M'
Instance Attribute Summary collapse
-
#fixture ⇒ Object
readonly
Returns the value of attribute fixture.
Class Method Summary collapse
Instance Method Summary collapse
-
#definition ⇒ Object
Internal: my_node[This is a node]:::awesome_style.
- #depends_on?(node) ⇒ Boolean
- #description ⇒ Object
-
#initialize(fixture) ⇒ Node
constructor
A new instance of Node.
- #links? ⇒ Boolean
- #name ⇒ Object
- #slot ⇒ Object
- #style_class ⇒ Object
Constructor Details
#initialize(fixture) ⇒ Node
20 21 22 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 20 def initialize(fixture) @fixture = fixture end |
Instance Attribute Details
#fixture ⇒ Object (readonly)
Returns the value of attribute fixture.
10 11 12 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 10 def fixture @fixture end |
Class Method Details
.for(fixture) ⇒ Object
14 15 16 17 18 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 14 def self.for(fixture) node_class = fixture.playable? ? self : ByeNode node_class.new(fixture) end |
Instance Method Details
#definition ⇒ Object
Internal: my_node[This is a node]:::awesome_style
29 30 31 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 29 def definition "#{name}[#{description}]:::#{style_class}" end |
#depends_on?(node) ⇒ Boolean
49 50 51 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 49 def depends_on?(node) fixture.depends_on?(node.fixture) end |
#description ⇒ Object
37 38 39 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 37 def description "#{match_id}\\n#{title}\\n#{slot}" end |
#links? ⇒ Boolean
45 46 47 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 45 def links? fixture.dependencies? end |
#name ⇒ Object
24 25 26 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 24 def name "#{category}_#{match_id}" end |
#slot ⇒ Object
41 42 43 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 41 def slot fixture.slot.strftime(TIME_TEMPLATE) end |
#style_class ⇒ Object
33 34 35 |
# File 'lib/sports_manager/solution_drawer/mermaid/node.rb', line 33 def style_class "court#{court}" end |