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.
-
#formation ⇒ Object
Returns the value of attribute formation.
-
#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
149 150 151 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 149 def coach @coach end |
#formation ⇒ Object
Returns the value of attribute formation
149 150 151 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 149 def formation @formation end |
#lineup ⇒ Object
Returns the value of attribute lineup
149 150 151 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 149 def lineup @lineup end |
#team ⇒ Object
Returns the value of attribute team
149 150 151 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 149 def team @team end |
Instance Method Details
#as_json ⇒ Object
150 151 152 153 154 155 156 157 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 150 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
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 159 def pretty_print( q ) q.group( 4, '<LineupLine ', '>') do q.text( team ) q.text( ' ' ) if formation q.text( "(#{formation})" ) q.text( ' ') else ## todo/fix - check for "flat" items - no formation ## or empty lineup (possible?) ## add formation e.g. (1-) 3-4-2-1 autoformation = lineup.map { |item| item.size } ## note - remove first entry (assume it's 1 for goalee!) autoformation.shift q.text( autoformation.join('-')) q.text( ' ') end q.pp( lineup ) if coach q.breakable q.text( "coach=" + coach ) end end end |