Class: Penalty

Inherits:
Object
  • Object
show all
Defined in:
lib/fbtxt-pp/models/penalties.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, scored:, score:, team:) ⇒ Penalty

Returns a new instance of Penalty.



17
18
19
20
21
22
23
24
25
# File 'lib/fbtxt-pp/models/penalties.rb', line 17

def initialize( name:,
                scored:, score:,
                team:  )
  @name     = name
  @scored   = scored
  @score    = score   ## maybe allow empty score - why? why not?

  @team     = team
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/fbtxt-pp/models/penalties.rb', line 14

def name
  @name
end

#scoreObject (readonly)

Returns the value of attribute score.



14
15
16
# File 'lib/fbtxt-pp/models/penalties.rb', line 14

def score
  @score
end

#scoredObject (readonly)

Returns the value of attribute scored.



14
15
16
# File 'lib/fbtxt-pp/models/penalties.rb', line 14

def scored
  @scored
end

#teamObject (readonly)

Returns the value of attribute team.



14
15
16
# File 'lib/fbtxt-pp/models/penalties.rb', line 14

def team
  @team
end

Class Method Details

.build(h) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/fbtxt-pp/models/penalties.rb', line 4

def self.build( h )

  new( name:   h['name'],
       scored: h['scored'],   ## true|false  for now only
       score:  h['score'],
       team:   h['team']     ## 1|2
       )
end

Instance Method Details

#scored?Boolean

Returns:

  • (Boolean)


27
# File 'lib/fbtxt-pp/models/penalties.rb', line 27

def scored?() @scored; end