Class: HustleAndFlow::Formatters::BranchTableFormatter
- Inherits:
-
Object
- Object
- HustleAndFlow::Formatters::BranchTableFormatter
- Defined in:
- lib/hustle_and_flow/formatters/branch_table_formatter.rb
Instance Attribute Summary collapse
-
#branches ⇒ Object
Returns the value of attribute branches.
Instance Method Summary collapse
-
#initialize(branches) ⇒ BranchTableFormatter
constructor
A new instance of BranchTableFormatter.
- #to_ary ⇒ Object
Constructor Details
#initialize(branches) ⇒ BranchTableFormatter
Returns a new instance of BranchTableFormatter.
6 7 8 |
# File 'lib/hustle_and_flow/formatters/branch_table_formatter.rb', line 6 def initialize(branches) self.branches = branches end |
Instance Attribute Details
#branches ⇒ Object
Returns the value of attribute branches.
4 5 6 |
# File 'lib/hustle_and_flow/formatters/branch_table_formatter.rb', line 4 def branches @branches end |
Instance Method Details
#to_ary ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hustle_and_flow/formatters/branch_table_formatter.rb', line 10 def to_ary number = 0 branches.map do |branch| [ { format: number_formatting(branch), value: number += 1, }, { format: current_branch_formatting(branch), value: branch.current? ? '*' : ' ', }, { format: status_formatting(branch), value: status(branch), }, { format: (branch), value: branch., }, { format: name_formatting(branch), value: branch.name, }, ] end end |