lib/codeguessing/console.rb in codeguessing-0.3.0 vs lib/codeguessing/console.rb in codeguessing-0.3.1
- old
+ new
@@ -1,8 +1,8 @@
module Codeguessing
class Console
- def initialize(again = false, opt)
+ def initialize(again = false, opt = {})
@path = File.join(File.dirname(__FILE__), 'scores.yml')
@scores = load(@path)
@game = Game.new(opt)
return start if again
knowing
@@ -80,10 +80,10 @@
YAML.load(File.open(path)) if File.exist?(path)
end
def save(name = 'Anonim')
return if @game.state != true
- @scores << @game.cur_score
+ @scores << @game.cur_score(name)
File.new(@path, 'w') unless File.exist?(@path)
File.open(@path, "r+") do |f|
f.write(@scores.to_yaml)
end
@scores