Class: Goal

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#minuteObject (readonly)

Returns the value of attribute minute.



20
21
22
# File 'lib/fbtxt-pp/models/goals.rb', line 20

def minute
  @minute
end

#nameObject (readonly)

Returns the value of attribute name.



20
21
22
# File 'lib/fbtxt-pp/models/goals.rb', line 20

def name
  @name
end

#ogObject (readonly)

Returns the value of attribute og.



20
21
22
# File 'lib/fbtxt-pp/models/goals.rb', line 20

def og
  @og
end

#penObject (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

Returns:

  • (Boolean)


38
# File 'lib/fbtxt-pp/models/goals.rb', line 38

def og?()  @og; end

#pen?Boolean

Returns:

  • (Boolean)


39
# File 'lib/fbtxt-pp/models/goals.rb', line 39

def pen?() @pen; end