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
160 161 162 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 160 def captain @captain end |
#cards ⇒ Object
Returns the value of attribute cards
160 161 162 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 160 def cards @cards end |
#name ⇒ Object
Returns the value of attribute name
160 161 162 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 160 def name @name end |
#sub ⇒ Object
Returns the value of attribute sub
160 161 162 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 160 def sub @sub end |
Instance Method Details
#as_json ⇒ Object
161 162 163 164 165 166 167 168 169 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 161 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
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 171 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 |