Class: Application
- Inherits:
-
Object
- Object
- Application
- Includes:
- Singleton
- Defined in:
- lib/asker/application.rb
Overview
Global parameters
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
12 13 14 |
# File 'lib/asker/application.rb', line 12 def initialize reset end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/asker/application.rb', line 10 def config @config end |
Instance Method Details
#reset ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/asker/application.rb', line 16 def reset filename = File.join(Dir.pwd, Asker::CONFIGFILE) unless File.exist? filename filename = File.join(File.dirname(__FILE__), "files", Asker::CONFIGFILE) end begin @config = IniFile.load(filename) rescue => e Logger.error e.display Logger.error "Application: Revise configuration file (#{filename})" exit 1 end stages = @config["questions"]["stages"].split(",") @config["questions"]["stages"] = stages.map(&:to_sym) fractions = @config["questions"]["fractions"].split(",") @config["questions"]["fractions"] = fractions + Array.new(5, "0") Rainbow.enabled = false Rainbow.enabled = true if @config["global"]["color"].downcase == "yes" end |