Module: Branch::Name::Loadable
Constant Summary
Constants included from Configurable
Configurable::CONFIG_FILENAME, Configurable::DEFAULT_BRANCH_NAME_OPTIONS
Constants included from Colorizable
Colorizable::ABORTED, Colorizable::ERROR, Colorizable::SUCCESS, Colorizable::WARNING
Instance Method Summary collapse
Methods included from Configurable
#create_config_file, #create_global_config_file!, #create_local_config_file!, #delete_global_config_file!, #delete_local_config_file!, #global_config_file, #global_config_file?, #local_config_file, #local_config_file?, #print_global_config_file, #print_local_config_file
Methods included from Locatable
global_folder?, home_folder, local_folder, project_folder, temp_folder
Instance Method Details
#load_config(config_file) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/branch/name/loadable.rb', line 21 def load_config(config_file) return {} unless File.exist? config_file = File.read(config_file) YAML.safe_load ERB.new().result end |
#load_options(defaults: {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/branch/name/loadable.rb', line 12 def (defaults: {}) = {} .merge!(load_config(global_config_file)) .merge!(load_config(local_config_file)) .presence || defaults end |