Class: Pokerstats::HandHistory
- Inherits:
-
Object
- Object
- Pokerstats::HandHistory
- Defined in:
- lib/pokerstats/hand_history.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#position ⇒ Object
Returns the value of attribute position.
-
#source ⇒ Object
Returns the value of attribute source.
-
#stats ⇒ Object
Returns the value of attribute stats.
Instance Method Summary collapse
-
#initialize(lines, source, position, parser_class = PokerstarsHandHistoryParser) ⇒ HandHistory
constructor
A new instance of HandHistory.
- #parse ⇒ Object
- #parsed? ⇒ Boolean
- #reports ⇒ Object
Constructor Details
#initialize(lines, source, position, parser_class = PokerstarsHandHistoryParser) ⇒ HandHistory
Returns a new instance of HandHistory.
7 8 9 10 11 12 13 14 |
# File 'lib/pokerstats/hand_history.rb', line 7 def initialize lines, source, position, parser_class = PokerstarsHandHistoryParser @lines = lines @source = source @position = position @parsed = false @parser_class = parser_class @stats = HandStatistics.new end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
6 7 8 |
# File 'lib/pokerstats/hand_history.rb', line 6 def lines @lines end |
#position ⇒ Object
Returns the value of attribute position.
6 7 8 |
# File 'lib/pokerstats/hand_history.rb', line 6 def position @position end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/pokerstats/hand_history.rb', line 6 def source @source end |
#stats ⇒ Object
Returns the value of attribute stats.
6 7 8 |
# File 'lib/pokerstats/hand_history.rb', line 6 def stats @stats end |
Instance Method Details
#parse ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pokerstats/hand_history.rb', line 20 def parse @parser = @parser_class.new(@stats) @lines.each do |each_line| begin @parser.parse(each_line) rescue => e raise "#{@source}:#{position}: #{e.}" end end @stats.update_hand :session_filename => source, :starting_at => position @parsed = true end |
#parsed? ⇒ Boolean
16 17 18 |
# File 'lib/pokerstats/hand_history.rb', line 16 def parsed? @parsed end |
#reports ⇒ Object
33 34 35 36 |
# File 'lib/pokerstats/hand_history.rb', line 33 def reports parse unless parsed? @stats.reports end |