Sha256: 14397bc469c7c242776a1d448cecc5bba0cbc964b04d3ae3e4dce10486ed9adf
Contents?: true
Size: 947 Bytes
Versions: 1
Compression:
Stored size: 947 Bytes
Contents
require 'curses' require 'logger' require 'tempfile' require 'falling/version' require 'falling/universe' require 'falling/interface' module Falling class << self def start_game logger.info 'Booting up.' Interface.new(universe: Falling::Universe.new).run! logger.info 'Quitting.' ensure log_file.close log_file.unlink if log_file.is_a? Tempfile end def logger @logger ||= Logger.new(log_file).tap do |logger| logger.level = if development? Logger::DEBUG else Logger::WARN end end end private def log_file @log_file ||= if development? File.open('./development.log', File::WRONLY | File::APPEND | File::CREAT) else Tempfile.new('falling.log') end end def development? ENV['FALLING_ENV'] == 'development' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
falling-0.0.1 | lib/falling.rb |