Class: SportDb::Parser::GoalMinute

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

Overview

FIX/FIX/FIX split into Minute and GoalMinute (Minute+GoalType)

fix - move :og, :pen to Goal if possible - why? why not? or change to GoalMinute ???

fix!!! split into GoalMinute and Minute goal_minute incl. :og, :pen, :freekick, :header, seconds etc.

GoalMinute = Minute + GoalType !!!

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#freekickObject

Returns the value of attribute freekick

Returns:

  • (Object)

    the current value of freekick



227
228
229
# File 'lib/sportdb/parser/parse_tree-match.rb', line 227

def freekick
  @freekick
end

#headerObject

Returns the value of attribute header

Returns:

  • (Object)

    the current value of header



227
228
229
# File 'lib/sportdb/parser/parse_tree-match.rb', line 227

def header
  @header
end

#mObject

Returns the value of attribute m

Returns:

  • (Object)

    the current value of m



227
228
229
# File 'lib/sportdb/parser/parse_tree-match.rb', line 227

def m
  @m
end

#offsetObject

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



227
228
229
# File 'lib/sportdb/parser/parse_tree-match.rb', line 227

def offset
  @offset
end

#ogObject

Returns the value of attribute og

Returns:

  • (Object)

    the current value of og



227
228
229
# File 'lib/sportdb/parser/parse_tree-match.rb', line 227

def og
  @og
end

#penObject

Returns the value of attribute pen

Returns:

  • (Object)

    the current value of pen



227
228
229
# File 'lib/sportdb/parser/parse_tree-match.rb', line 227

def pen
  @pen
end

#secsObject

Returns the value of attribute secs

Returns:

  • (Object)

    the current value of secs



227
228
229
# File 'lib/sportdb/parser/parse_tree-match.rb', line 227

def secs
  @secs
end

Instance Method Details

#as_jsonObject



232
# File 'lib/sportdb/parser/parse_tree-match.rb', line 232

def as_json(*)  to_s; end

#pretty_print(q) ⇒ Object



247
248
249
# File 'lib/sportdb/parser/parse_tree-match.rb', line 247

def pretty_print( q )
   q.text( to_s )
end

#to_goal_typeObject



259
260
261
262
263
264
265
266
267
268
# File 'lib/sportdb/parser/parse_tree-match.rb', line 259

def to_goal_type
    if og || pen || header || freekick
      GoalType.new( og:       og,
                    pen:      pen,
                    header:   header,
                    freekick: freekick )
    else
       nil   ## note - return nil; if no goal type present!!
    end
end

#to_minuteObject

quick hack: split struct into Minute+GoalType structs



253
254
255
256
257
# File 'lib/sportdb/parser/parse_tree-match.rb', line 253

def to_minute
    Minute.new( m:      m,
                offset: offset,
                secs:   secs )
end

#to_sObject



234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/sportdb/parser/parse_tree-match.rb', line 234

def to_s
  buf = String.new
  buf << "#{m}"
  buf << "'"
  buf << "+#{offset}"  if offset
  buf << "(og)"   if og
  buf << "(p)"  if pen
  buf << "(f)"  if freekick
  buf << "(h)"  if header
  buf << " (#{secs} secs)"   if secs
  buf
end