Class: RaccMatchParser::GoalMinute

Inherits:
Struct
  • Object
show all
Defined in:
lib/sportdb/parser/racc_tree.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



473
474
475
# File 'lib/sportdb/parser/racc_tree.rb', line 473

def freekick
  @freekick
end

#headerObject

Returns the value of attribute header

Returns:

  • (Object)

    the current value of header



473
474
475
# File 'lib/sportdb/parser/racc_tree.rb', line 473

def header
  @header
end

#mObject

Returns the value of attribute m

Returns:

  • (Object)

    the current value of m



473
474
475
# File 'lib/sportdb/parser/racc_tree.rb', line 473

def m
  @m
end

#offsetObject

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



473
474
475
# File 'lib/sportdb/parser/racc_tree.rb', line 473

def offset
  @offset
end

#ogObject

Returns the value of attribute og

Returns:

  • (Object)

    the current value of og



473
474
475
# File 'lib/sportdb/parser/racc_tree.rb', line 473

def og
  @og
end

#penObject

Returns the value of attribute pen

Returns:

  • (Object)

    the current value of pen



473
474
475
# File 'lib/sportdb/parser/racc_tree.rb', line 473

def pen
  @pen
end

#secsObject

Returns the value of attribute secs

Returns:

  • (Object)

    the current value of secs



473
474
475
# File 'lib/sportdb/parser/racc_tree.rb', line 473

def secs
  @secs
end

Instance Method Details

#pretty_print(printer) ⇒ Object



489
490
491
# File 'lib/sportdb/parser/racc_tree.rb', line 489

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

#to_goal_typeObject



501
502
503
504
505
506
507
508
509
510
# File 'lib/sportdb/parser/racc_tree.rb', line 501

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

#to_minuteObject

quick hack: split struct into Minute+GoalType structs



495
496
497
498
499
# File 'lib/sportdb/parser/racc_tree.rb', line 495

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

#to_sObject



476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/sportdb/parser/racc_tree.rb', line 476

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