Class: Minute

Inherits:
Struct show all
Defined in:
lib/fifadat/convert/helper-minute.rb

Overview

note - check if m(inute) might be unknown e.g. '??' or such

offset (aka stoppage/injury/added time)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#m ⇒ Object

Returns the value of attribute m

Returns:

  • (Object) —

    the current value of m



8
9
10
# File 'lib/fifadat/convert/helper-minute.rb', line 8

def m
  @m
end

#offset ⇒ Object

Returns the value of attribute offset

Returns:

  • (Object) —

    the current value of offset



8
9
10
# File 'lib/fifadat/convert/helper-minute.rb', line 8

def offset
  @offset
end

#period ⇒ Object

Returns the value of attribute period

Returns:

  • (Object) —

    the current value of period



8
9
10
# File 'lib/fifadat/convert/helper-minute.rb', line 8

def period
  @period
end

Instance Method Details

#<=>(other) ⇒ Object

add compare (for sort)



20
21
22
23
24
# File 'lib/fifadat/convert/helper-minute.rb', line 20

def <=>( other )
     res = self.m           <=> other.m
     res = (self.offset||0) <=> (other.offset||0)   if res == 0
     res
end

#as_json ⇒ Object



9
# File 'lib/fifadat/convert/helper-minute.rb', line 9

def as_json(*) to_s; end

#to_s ⇒ Object

note - format minute WITHOUT minute marker/quote (')



12
13
14
15
16
17
# File 'lib/fifadat/convert/helper-minute.rb', line 12

def to_s
    buf =  String.new
    buf << "#{m}"
    buf << "+#{offset}"      if offset
    buf
end