class EulerPoker::CLI
Attributes
results[R]
Public Class Methods
new(file)
click to toggle source
# File lib/euler_poker/cli.rb, line 5 def initialize(file) @file = File.open(file, 'r') print_results end
Private Instance Methods
print_results()
click to toggle source
# File lib/euler_poker/cli.rb, line 12 def print_results hands = 0 results = [] @file.each_line do |line| round = EulerPoker::Round.new(line) results << round.winner hands += 1 end @file.close puts "Player 1 won #{results.count(:first)} out of #{hands} hands." end