Method: Frameit::ConfigParser#change_paths_to_absolutes!
- Defined in:
- frameit/lib/frameit/config_parser.rb
#change_paths_to_absolutes!(values) ⇒ Object
Use absolute paths instead of relative
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'frameit/lib/frameit/config_parser.rb', line 45 def change_paths_to_absolutes!(values) values.each do |key, value| if value.kind_of?(Hash) change_paths_to_absolutes!(value) # recursive call elsif value.kind_of?(Array) value.each do |current| change_paths_to_absolutes!(current) if current.kind_of?(Hash) # recursive call end else if ['font', 'background'].include?(key) # Change the paths to relative ones # `replace`: to change the content of the string, so it's actually stored if @path # where is the config file. We don't have a config file in tests containing_folder = File.('..', @path) value.replace(File.join(containing_folder, value)) end end end end end |