Module: Codebreaker
- Defined in:
- lib/codebreaker.rb,
lib/codebreaker/version.rb,
lib/codebreaker/bll/game_engine.rb
Defined Under Namespace
Modules: BLL
Constant Summary collapse
- STAT_FILE =
'./statistic.yaml'- NoAttamptsError =
Class.new(ArgumentError)
- VERSION =
'0.1.8'
Class Method Summary collapse
- .create(**diffucult) ⇒ Object
- .fetch_statistic(path) ⇒ Object
- .save_statistic(path, **statistic_info) ⇒ Object
Class Method Details
.create(**diffucult) ⇒ Object
9 10 11 |
# File 'lib/codebreaker.rb', line 9 def create(**diffucult) BLL::GameEngine.new(**diffucult) end |
.fetch_statistic(path) ⇒ Object
25 26 27 28 29 |
# File 'lib/codebreaker.rb', line 25 def fetch_statistic(path) create_db path YAML.load_file path end |
.save_statistic(path, **statistic_info) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/codebreaker.rb', line 13 def save_statistic(path, **statistic_info) [].tap do |data_to_write| data_to_write << statistic_info create_db path data_to_write.concat YAML.load_file(path) if YAML.load_file(path) File.open(path, 'w') { |file| file.write(data_to_write.to_yaml) } end end |