Class: SportDb::Parser::Sub

Inherits:
Struct
  • Object
show all
Defined in:
lib/sportdb/parser/parse_tree-props.rb

Overview

fix-fix-fix change :sub to :lineup - why? why not?

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#minuteObject

Returns the value of attribute minute

Returns:

  • (Object)

    the current value of minute



214
215
216
# File 'lib/sportdb/parser/parse_tree-props.rb', line 214

def minute
  @minute
end

#subObject

Returns the value of attribute sub

Returns:

  • (Object)

    the current value of sub



214
215
216
# File 'lib/sportdb/parser/parse_tree-props.rb', line 214

def sub
  @sub
end

Instance Method Details

#as_jsonObject



215
216
217
218
219
220
221
# File 'lib/sportdb/parser/parse_tree-props.rb', line 215

def as_json(*)
  h = { 'lineup' => sub.as_json }
  h['minute'] =  minute.as_json       if minute

  ## ['<Sub>', h]
  h  # note - return "inline" json object (not tagged array with json object)
end

#pretty_print(q) ⇒ Object



223
224
225
226
227
228
# File 'lib/sportdb/parser/parse_tree-props.rb', line 223

def pretty_print( q )
  q.group( 0, '(', ')') do
     q.text( "#{minute.to_s} " )   if minute
     q.pp( sub )
  end
end