lib/hasmenu/formatter.rb in hasmenu-0.1.6 vs lib/hasmenu/formatter.rb in hasmenu-0.1.7
- old
+ new
@@ -3,11 +3,11 @@
module Hasmenu
class Formatter
include Printer
def initialize(type, options)
- @type = type
+ @type = type.chomp("/")
@location = options[:location] || Dir.pwd
end
def valid_path?(path)
(File.file?(path) && File.extname(path) == ".yml") || File.directory?(path)
@@ -30,10 +30,10 @@
File.open(path, "w") { |f| f.write data.to_yaml }
print_format_for File.basename(File.dirname(path))
end
def format_files(path)
- Dir.glob(path + "/**/*.yml") do |file|
+ Dir.glob(File.join(path, "**", "*.yml")) do |file|
format_file file
end
end
def format(path)