Module: CWG::Cfg

Included in:
CwDsl
Defined in:
/Users/martyn/cw/cw_clone/lib/cw/config.rb

Constant Summary

HERE =
File.dirname(__FILE__) + '/'
CONFIG_METHODS =
[
  :name,:wpm,:effective_wpm,:frequency,:audio_filename,:audio_dir,
  :book_name,:book_dir,:play_command,:size,:run_default,:word_spacing,
  :command_line,:author,:title,:quality,:ebook2cw_path,:noise,:tone,
  :word_count,:volume,:list_colour,:success_colour,:fail_colour,
  :no_run,:run,:print_letters,:no_print,:use_ebook2cw,
  :dictionary,:containing,:begin,:end,:including,:word_filename,:max,:min,
  :exit
]

Class Method Summary (collapse)

Class Method Details

+ (Object) config



19
20
21
22
23
24
25
26
27
28
29
# File '/Users/martyn/cw/cw_clone/lib/cw/config.rb', line 19

def self.config
  unless @config
    @config = ParseConfig.new(File.join HERE, '..', '..', '.cw_config')
    CONFIG_METHODS.each do |method|
      unless @config[method.to_s]
        @config.add method.to_s, nil
      end
    end
  end
  return @config
end

+ (Object) reset



31
32
33
# File '/Users/martyn/cw/cw_clone/lib/cw/config.rb', line 31

def self.reset
  @config = nil
end