Class: Fbtxt::Parser::LineupLine
- Defined in:
- lib/fbtxt/parser/parse_tree-props.rb
Overview
change :lineup to :lineups (e.g. requires array of lineups)
Instance Attribute Summary collapse
-
#coach ⇒ Object
Returns the value of attribute coach.
-
#lineup ⇒ Object
Returns the value of attribute lineup.
-
#team ⇒ Object
Returns the value of attribute team.
Instance Method Summary collapse
Instance Attribute Details
#coach ⇒ Object
Returns the value of attribute coach
125 126 127 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 125 def coach @coach end |
#lineup ⇒ Object
Returns the value of attribute lineup
125 126 127 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 125 def lineup @lineup end |
#team ⇒ Object
Returns the value of attribute team
125 126 127 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 125 def team @team end |
Instance Method Details
#as_json ⇒ Object
126 127 128 129 130 131 132 133 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 126 def as_json(*) h = { 'team' => team.as_json, 'lineups' => lineup.as_json } h['coach'] = coach.as_json if coach ['<LineupLine>', h] end |
#pretty_print(q) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 135 def pretty_print( q ) q.group( 4, '<LineupLine ', '>') do q.text( team ) q.text( ' ' ) ## todo/fix - check for "flat" items - no formation ## or empty lineup (possible?) ## add formation e.g. (1-) 3-4-2-1 formation = lineup.map { |item| item.size } ## note - remove first entry (assume it's 1 for goalee!) formation.shift q.text( formation.join('-')) q.text( ' ') q.pp( lineup ) if coach q.breakable q.text( "coach=" + coach ) end end end |