Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
100% Git-compliant actor creation
Some more tweaks here:

	- Do not use `strftime`, because it's not assured
	to be cross-platform

	- Use C-like string formatting for Great Glory
	When Printing Numbers.

	- Always print an email address -- even if we don't
	have one. A missing email field will crash `fsck`.
  • Loading branch information
vmg committed Aug 20, 2011
1 parent e33fad9 commit ff01507
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/grit/actor.rb
Expand Up @@ -34,11 +34,13 @@ def self.from_string(str)
#
# Returns a String.
def output(time)
out = @name.to_s.dup
if @email
out << " <#{@email}>"
end
out << time.strftime(" %s %z")
offset = time.utc_offset / 60
"%s <%s> %d %+.2d%.2d" % [
@name,
@email || "null",
time.to_i,
offset / 60,
offset.abs % 60]
end

# Pretty object inspection
Expand Down

0 comments on commit ff01507

Please sign in to comment.