lib/jorm/folder.rb in jorm-0.0.1 vs lib/jorm/folder.rb in jorm-0.0.2
- old
+ new
@@ -7,15 +7,27 @@
def initialize path
@path = ::Pathname.new path
end
- def normalized?
- Jorm.normalized? path.to_s
+ def can_normalize?
+ Jorm.can_normalize? path.to_s
end
+ def should_normalize?
+ is_folder? && can_normalize? && !already_normalized?
+ end
+
+ def is_folder?
+ path.directory?
+ end
+
+ def already_normalized?
+ Jorm.already_normalized? path.to_s
+ end
+
def normalize!
- return if normalized?
+ return unless should_normalize?
FileUtils.mv path, Jorm.normalize_id(path.to_s)
end
end
end