to_s methods for debugging

This commit is contained in:
Tomasz Gieniusz 2012-10-13 12:38:07 +02:00
parent e48fab4fed
commit f727869402
6 changed files with 21 additions and 1 deletions

View File

@ -15,6 +15,10 @@ module GitStats
@activity ||= Activity.new(commits)
end
def to_s
"#{self.class} #@name <#@email>"
end
end
end
end

View File

@ -13,6 +13,10 @@ module GitStats
def in_repo
Dir.chdir(@repo.path) { yield }
end
def to_s
"#{self.class} #@command"
end
end
end
end

View File

@ -14,6 +14,10 @@ module GitStats
def short_stat
@short_stat ||= ShortStat.new(self)
end
def to_s
"#{self.class} #@hash"
end
end
end
end

View File

@ -38,6 +38,10 @@ module GitStats
@project_name ||= Pathname(path).basename.to_s
end
def to_s
"#{self.class} #@path"
end
end
end
end

View File

@ -18,6 +18,10 @@ module GitStats
@deletions = stat_line[/(\d+) deletions?/, 1].to_i
end
end
def to_s
"#{self.class} #@commit"
end
end
end
end

View File

@ -1,5 +1,5 @@
module HashInitializable
def initialize(params)
def initialize(params = {})
params.each { |k, v| instance_variable_set("@#{k}", v) }
end
end