class YamlSmoosher
Constants
- VERSION
Public Class Methods
call(args)
click to toggle source
# File lib/yaml_smoosher.rb, line 9 def call(args) new(args).call end
new(path_to_folder)
click to toggle source
# File lib/yaml_smoosher.rb, line 14 def initialize(path_to_folder) @path_to_folder = path_to_folder end
Public Instance Methods
call()
click to toggle source
# File lib/yaml_smoosher.rb, line 18 def call result = {} parse_yaml_files(result) parse_yaml_erb_files(result) result end
Private Instance Methods
parse_yaml_erb_files(hash)
click to toggle source
# File lib/yaml_smoosher.rb, line 37 def parse_yaml_erb_files(hash) yaml_files = Dir.glob(File.join(@path_to_folder, "/**/*.yml.erb")) yaml_files.each do |yaml_erb_file| hash.deep_merge!(YAML.load(ERB.new(File.read(yaml_erb_file)).result)) end end
parse_yaml_files(hash)
click to toggle source
# File lib/yaml_smoosher.rb, line 29 def parse_yaml_files(hash) yaml_files = Dir.glob(File.join(@path_to_folder, "/**/*.yml")) yaml_files.each do |yaml_file| hash.deep_merge!(YAML.load(File.read(yaml_file))) end end