class RecommendMe::Helpers
Public Class Methods
load_config_file(default_options, modified_options)
click to toggle source
# File lib/recommend_me/helpers.rb, line 9 def self.load_config_file(default_options, modified_options) config_file = default_options.merge!(modified_options)[:config_file] File.exists?(config_file) ? config_file : raise_er end
merge_configs(default_config, config, sym_hash)
click to toggle source
# File lib/recommend_me/helpers.rb, line 18 def self.merge_configs(default_config, config, sym_hash) combined_config = default_config.merge!(sym_hash) combined_config_options = combined_config.merge(config) config.replace(combined_config_options) end
read_file(path)
click to toggle source
# File lib/recommend_me/helpers.rb, line 24 def self.read_file(path) p "OPENING FILE : #{path} FOR READ\n" ::File.open(path, 'r') { |f| f.read } end
write_file(path, data)
click to toggle source
# File lib/recommend_me/helpers.rb, line 29 def self.write_file(path, data) p "WRITING DATA : #{data} TO FILE : #{path}\n" ::File.open(path, 'w') { |f| f.write(data) } end
Public Instance Methods
raise_er()
click to toggle source
# File lib/recommend_me/helpers.rb, line 14 def raise_er raise 'Selected config file does not exists or does not have read permissions' end