Sha256: 64b128af72d748ca3691c9f720d577541ddb00efb6196e53482c26956c24be9d
Contents?: true
Size: 831 Bytes
Versions: 2
Compression:
Stored size: 831 Bytes
Contents
require "yaml" module Hasmenu class Formatter include Printer def initialize(options) @location = options[:location] || Dir.pwd end def format_file(path) file = YAML.load_file(path) File.open(path, "w") { |f| f.write file.to_yaml } print_format_for File.basename(File.dirname(path)) end def format_files(path) Dir.glob(path + "/**/*.yml") do |file| format_file file end end def format(path) path = File.join(@location, path) unless File.exist? path print_invalid_path return end print_format_start if File.file?(path) && File.extname(path) == ".yml" format_file path elsif File.directory? path format_files path else print_invalid_path end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hasmenu-0.1.5 | lib/hasmenu/formatter.rb |
hasmenu-0.1.4 | lib/hasmenu/formatter.rb |