Class: Fbtxt::Parser::MatchLine

Inherits:
Struct
  • Object
show all
Defined in:
lib/fbtxt/parser/parse_tree-match.rb

Overview

tty = TELETYPE MODE for teams and score!!

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attObject

Returns the value of attribute att

Returns:

  • (Object)

    the current value of att



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def att
  @att
end

#dateObject

Returns the value of attribute date

Returns:

  • (Object)

    the current value of date



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def date
  @date
end

#geoObject

Returns the value of attribute geo

Returns:

  • (Object)

    the current value of geo



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def geo
  @geo
end

#headerObject

Returns the value of attribute header

Returns:

  • (Object)

    the current value of header



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def header
  @header
end

#neutralObject

Returns the value of attribute neutral

Returns:

  • (Object)

    the current value of neutral



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def neutral
  @neutral
end

#noteObject

Returns the value of attribute note

Returns:

  • (Object)

    the current value of note



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def note
  @note
end

#numObject

Returns the value of attribute num

Returns:

  • (Object)

    the current value of num



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def num
  @num
end

#round_inline_bigObject

Returns the value of attribute round_inline_big

Returns:

  • (Object)

    the current value of round_inline_big



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def round_inline_big
  @round_inline_big
end

#round_inline_shortObject

Returns the value of attribute round_inline_short

Returns:

  • (Object)

    the current value of round_inline_short



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def round_inline_short
  @round_inline_short
end

#scoreObject

Returns the value of attribute score

Returns:

  • (Object)

    the current value of score



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def score
  @score
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def status
  @status
end

#status_inlineObject

Returns the value of attribute status_inline

Returns:

  • (Object)

    the current value of status_inline



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def status_inline
  @status_inline
end

#status_noteObject

Returns the value of attribute status_note

Returns:

  • (Object)

    the current value of status_note



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def status_note
  @status_note
end

#team1Object

Returns the value of attribute team1

Returns:

  • (Object)

    the current value of team1



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def team1
  @team1
end

#team2Object

Returns the value of attribute team2

Returns:

  • (Object)

    the current value of team2



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def team2
  @team2
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def time
  @time
end

#time_localObject

Returns the value of attribute time_local

Returns:

  • (Object)

    the current value of time_local



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def time_local
  @time_local
end

#ttyObject

Returns the value of attribute tty

Returns:

  • (Object)

    the current value of tty



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def tty
  @tty
end

#yearObject

Returns the value of attribute year

Returns:

  • (Object)

    the current value of year



48
49
50
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 48

def year
  @year
end

Instance Method Details

#as_jsonObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 60

def as_json(*)
  h =  { 'team1' => team1.as_json,
         'team2' => team2.as_json,
       }

    members.zip(values) do |name, value|
      next if [:team1, :team2].include?( name )
      next if value.nil?

      h[name.to_s] = value.as_json
    end

  ['<MatchLine>', h]
end

#pretty_print(q) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/fbtxt/parser/parse_tree-match.rb', line 76

def pretty_print( q )
  q.group( 4, '<MatchLine ', '>') do        ##  group( indent, open, close)
    q.text( "#{team1} v #{team2}")

    members.zip(values) do |name, value|
      next if [:team1, :team2].include?( name )
      next if value.nil?

      q.breakable
      q.text( "#{name}=" )
      q.pp( value )
    end
  end
end