Class: Lhj::LocalConfig
- Inherits:
-
Object
- Object
- Lhj::LocalConfig
- Defined in:
- lib/lhj/helper/local_config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #config_file ⇒ Object
- #config_file_name ⇒ Object
- #get_col_by_name(file_name, col_name = 'csv_key_col') ⇒ Object
- #load_config ⇒ Object
- #syn_config_file ⇒ Object
Class Method Details
.instance ⇒ Object
35 36 37 |
# File 'lib/lhj/helper/local_config.rb', line 35 def self.instance @instance ||= new end |
Instance Method Details
#config ⇒ Object
31 32 33 |
# File 'lib/lhj/helper/local_config.rb', line 31 def config @config ||= load_config end |
#config_file ⇒ Object
6 7 8 |
# File 'lib/lhj/helper/local_config.rb', line 6 def config_file File.join(Lhj::Config.instance.home_dir, config_file_name) end |
#config_file_name ⇒ Object
10 11 12 |
# File 'lib/lhj/helper/local_config.rb', line 10 def config_file_name 'localizable_config.yml' end |
#get_col_by_name(file_name, col_name = 'csv_key_col') ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/lhj/helper/local_config.rb', line 23 def get_col_by_name(file_name, col_name = 'csv_key_col') m = config col = m[col_name] fo = m['read_targets'].find{ |o| /#{o['csv_file']}/ =~ file_name } col = fo[col_name] if fo col end |
#load_config ⇒ Object
18 19 20 21 |
# File 'lib/lhj/helper/local_config.rb', line 18 def load_config syn_config_file unless File.exist?(config_file) YAML.load_file(config_file) end |