Class: SportDb::GoalStruct

Inherits:
Object
  • Object
show all
Defined in:
lib/sportdb/formats/goals.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ GoalStruct

add/allow quick and dirty quick init with keywords



45
46
47
48
49
50
51
52
53
# File 'lib/sportdb/formats/goals.rb', line 45

def initialize( **kwargs )    ## add/allow quick and dirty quick init with keywords
  if kwargs.empty?
    # do nothing
  else
    kwargs.each do |key,value|
      send( "#{key}=", value )
    end
  end
end

Instance Attribute Details

#minuteObject

Returns the value of attribute minute.



38
39
40
# File 'lib/sportdb/formats/goals.rb', line 38

def minute
  @minute
end

#nameObject

flat struct for goals - one entry per goals



36
37
38
# File 'lib/sportdb/formats/goals.rb', line 36

def name
  @name
end

#offsetObject

Returns the value of attribute offset.



38
39
40
# File 'lib/sportdb/formats/goals.rb', line 38

def offset
  @offset
end

#owngoalObject

Returns the value of attribute owngoal.



39
40
41
# File 'lib/sportdb/formats/goals.rb', line 39

def owngoal
  @owngoal
end

#penaltyObject

Returns the value of attribute penalty.



39
40
41
# File 'lib/sportdb/formats/goals.rb', line 39

def penalty
  @penalty
end

#score1Object

gets calculated



40
41
42
# File 'lib/sportdb/formats/goals.rb', line 40

def score1
  @score1
end

#score2Object

gets calculated



40
41
42
# File 'lib/sportdb/formats/goals.rb', line 40

def score2
  @score2
end

#teamObject

1 or 2 ? check/todo: add team1 or team2 flag?



37
38
39
# File 'lib/sportdb/formats/goals.rb', line 37

def team
  @team
end

Instance Method Details

#==(o) ⇒ Object



55
56
57
# File 'lib/sportdb/formats/goals.rb', line 55

def ==(o)
  o.class == self.class && o.state == state
end

#stateObject



59
60
61
# File 'lib/sportdb/formats/goals.rb', line 59

def state
  [@name, @team, @minute, @offset, @penalty, @owngoal, @score1, @score2]
end