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



440
441
442
# File 'lib/sportdb/parser/racc_tree.rb', line 440

def freekick
  @freekick
end

#headerObject

Returns the value of attribute header

Returns:

  • (Object)

    the current value of header



440
441
442
# File 'lib/sportdb/parser/racc_tree.rb', line 440

def header
  @header
end

#mObject

Returns the value of attribute m

Returns:

  • (Object)

    the current value of m



440
441
442
# File 'lib/sportdb/parser/racc_tree.rb', line 440

def m
  @m
end

#offsetObject

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



440
441
442
# File 'lib/sportdb/parser/racc_tree.rb', line 440

def offset
  @offset
end

#ogObject

Returns the value of attribute og

Returns:

  • (Object)

    the current value of og



440
441
442
# File 'lib/sportdb/parser/racc_tree.rb', line 440

def og
  @og
end

#penObject

Returns the value of attribute pen

Returns:

  • (Object)

    the current value of pen



440
441
442
# File 'lib/sportdb/parser/racc_tree.rb', line 440

def pen
  @pen
end

#secsObject

Returns the value of attribute secs

Returns:

  • (Object)

    the current value of secs



440
441
442
# File 'lib/sportdb/parser/racc_tree.rb', line 440

def secs
  @secs
end

Instance Method Details

#pretty_print(printer) ⇒ Object



456
457
458
# File 'lib/sportdb/parser/racc_tree.rb', line 456

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

#to_goal_typeObject



468
469
470
471
472
473
474
475
476
477
# File 'lib/sportdb/parser/racc_tree.rb', line 468

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



462
463
464
465
466
# File 'lib/sportdb/parser/racc_tree.rb', line 462

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

#to_sObject



443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/sportdb/parser/racc_tree.rb', line 443

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