Class: Gollum::Git::Actor

Inherits:
Object
  • Object
show all
Defined in:
lib/rugged_adapter/git_layer_rugged.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, email, time = nil) ⇒ Actor

Returns a new instance of Actor.



40
41
42
43
44
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 40

def initialize(name, email, time = nil)
  @name = name
  @email = email
  @time = time
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



34
35
36
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 34

def email
  @email
end

#nameObject

Returns the value of attribute name.



34
35
36
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 34

def name
  @name
end

#timeObject

Returns the value of attribute time.



34
35
36
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 34

def time
  @time
end

Class Method Details

.default_actorObject



36
37
38
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 36

def self.default_actor
  self.new("Gollum", "Gollum@wiki")
end

Instance Method Details

#output(time) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 46

def output(time)
  # implementation from grit
  offset = time.utc_offset / 60
  "%s <%s> %d %+.2d%.2d" % [
  @name,
  @email || "null",
  time.to_i,
  offset / 60,
  offset.abs % 60]
end

#to_hObject



57
58
59
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 57

def to_h
  {:name => @name, :email => @email, :time => @time}
end