Class: Goal
- Inherits:
-
Object
- Object
- Goal
- Defined in:
- lib/fbtxt-pp/models/goals.rb
Instance Attribute Summary collapse
-
#minute ⇒ Object
readonly
Returns the value of attribute minute.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#og ⇒ Object
readonly
Returns the value of attribute og.
-
#pen ⇒ Object
readonly
Returns the value of attribute pen.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, minute:, og: false, pen: false) ⇒ Goal
constructor
A new instance of Goal.
- #og? ⇒ Boolean
- #pen? ⇒ Boolean
Constructor Details
#initialize(name:, minute:, og: false, pen: false) ⇒ Goal
Returns a new instance of Goal.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fbtxt-pp/models/goals.rb', line 23 def initialize( name:, minute:, og: false, pen: false ) norm = norm_name( name ) if norm != name puts " NORM GOAL/PLAYER NAME >#{name}< => >#{norm}<" name = norm end @name = name @minute = minute @og, @pen = og, pen end |
Instance Attribute Details
#minute ⇒ Object (readonly)
Returns the value of attribute minute.
20 21 22 |
# File 'lib/fbtxt-pp/models/goals.rb', line 20 def minute @minute end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/fbtxt-pp/models/goals.rb', line 20 def name @name end |
#og ⇒ Object (readonly)
Returns the value of attribute og.
20 21 22 |
# File 'lib/fbtxt-pp/models/goals.rb', line 20 def og @og end |
#pen ⇒ Object (readonly)
Returns the value of attribute pen.
20 21 22 |
# File 'lib/fbtxt-pp/models/goals.rb', line 20 def pen @pen end |
Class Method Details
.build(h) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fbtxt-pp/models/goals.rb', line 4 def self.build( h ) ## split into minute ## and offset (stoppage/injury time) ## e.g. 90'+11' ## ## keep minute as string and incl. stoppage/injury time - why? why not? new( name: h['name'], minute: h['minute'], og: h['og'], # true|false pen: h['pen'] # true|false ) end |
Instance Method Details
#og? ⇒ Boolean
38 |
# File 'lib/fbtxt-pp/models/goals.rb', line 38 def og?() @og; end |
#pen? ⇒ Boolean
39 |
# File 'lib/fbtxt-pp/models/goals.rb', line 39 def pen?() @pen; end |