lib/active_git/inflector.rb in active_git-0.0.4 vs lib/active_git/inflector.rb in active_git-0.0.5

- old
+ new

@@ -1,13 +1,21 @@ module ActiveGit module Inflector + def self.relative_dirname(model) + model.model_name.underscore.pluralize + end + def self.dirname(model, working_path=nil) - "#{working_path || ActiveGit.configuration.working_path}/#{model.model_name.underscore.pluralize}" + "#{working_path || ActiveGit.configuration.working_path}/#{relative_dirname(model)}" end def self.filename(instance, working_path=nil) "#{dirname(instance.class, working_path || ActiveGit.configuration.working_path)}/#{instance.id}.json" + end + + def self.relative_filename(instance) + "#{relative_dirname(instance.class)}/#{instance.id}.json" end def self.model(filename, working_path=nil) File.dirname(filename.gsub(working_path || ActiveGit.configuration.working_path, '')).classify.constantize end \ No newline at end of file