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.
13 14 15 |
# File 'lib/asker/application.rb', line 13 def initialize reset end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/asker/application.rb', line 11 def config @config end |
Instance Method Details
#reset ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/asker/application.rb', line 17 def reset filename = File.join(Dir.pwd, Asker::CONFIGFILE) filename = File.join(File.dirname(__FILE__), 'files', Asker::CONFIGFILE) unless File.exist? filename begin @config = IniFile.load(filename) rescue StandardError => e puts e.display puts Rainbow('[ERROR] Revise configuration file:').red.bright puts Rainbow(" #{filename}").red.bright 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') # require 'debug'; binding.break Rainbow.enabled = false Rainbow.enabled = true if @config['global']['color'].downcase == 'yes' end |