Class: Bchess::PGN::GameHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/pgn/game_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header) ⇒ GameHeader

Returns a new instance of GameHeader.



6
7
8
# File 'lib/pgn/game_header.rb', line 6

def initialize(header)
  @header = header
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



4
5
6
# File 'lib/pgn/game_header.rb', line 4

def header
  @header
end

#player_blackObject (readonly)

Returns the value of attribute player_black.



4
5
6
# File 'lib/pgn/game_header.rb', line 4

def player_black
  @player_black
end

#player_whiteObject (readonly)

Returns the value of attribute player_white.



4
5
6
# File 'lib/pgn/game_header.rb', line 4

def player_white
  @player_white
end

Instance Method Details

#dateObject



34
35
36
# File 'lib/pgn/game_header.rb', line 34

def date
  @date ||= values['Date']
end

#ecoObject



42
43
44
# File 'lib/pgn/game_header.rb', line 42

def eco
  @eco ||= values['Eco']
end

#elo_blackObject



22
23
24
# File 'lib/pgn/game_header.rb', line 22

def elo_black
  @elo_black ||= values['BlackElo']
end

#elo_whiteObject



18
19
20
# File 'lib/pgn/game_header.rb', line 18

def elo_white
  @elo_white ||= values['WhiteElo']
end

#eventObject



26
27
28
# File 'lib/pgn/game_header.rb', line 26

def event
  @event ||= values['Event']
end

#resultObject



46
47
48
# File 'lib/pgn/game_header.rb', line 46

def result
  @result ||= values['Result']
end

#roundObject



38
39
40
# File 'lib/pgn/game_header.rb', line 38

def round
  @round ||= values['Round']
end

#siteObject



30
31
32
# File 'lib/pgn/game_header.rb', line 30

def site
  @site ||= values['Site']
end

#valuesObject



50
51
52
# File 'lib/pgn/game_header.rb', line 50

def values
  @values ||= header.create_value_hash
end