Class: Fbtxt::Parser::Lineup
- Defined in:
- lib/fbtxt/parser/parse_tree-props.rb
Instance Attribute Summary collapse
-
#captain ⇒ Object
Returns the value of attribute captain.
-
#cards ⇒ Object
Returns the value of attribute cards.
-
#name ⇒ Object
Returns the value of attribute name.
-
#sub ⇒ Object
Returns the value of attribute sub.
Instance Method Summary collapse
Instance Attribute Details
#captain ⇒ Object
Returns the value of attribute captain
189 190 191 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 189 def captain @captain end |
#cards ⇒ Object
Returns the value of attribute cards
189 190 191 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 189 def cards @cards end |
#name ⇒ Object
Returns the value of attribute name
189 190 191 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 189 def name @name end |
#sub ⇒ Object
Returns the value of attribute sub
189 190 191 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 189 def sub @sub end |
Instance Method Details
#as_json ⇒ Object
190 191 192 193 194 195 196 197 198 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 190 def as_json(*) h = { 'name' => name.as_json } h['captain'] = captain.as_json if captain h['cards'] = cards.as_json if cards h['sub'] = sub.as_json if sub ## ['<Lineup>', h] h ## note - return "inline" json object (not tagged array with json object) end |
#pretty_print(q) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 200 def pretty_print( q ) q.group( 0, '', '') do ## group( indent, open, close) q.text( name ) q.text( ' [c]' ) if captain if cards q.text( ' ' ) q.pp( cards ) end if sub q.breakable ## can become either a space or a newline q.pp( sub ) end end end |