Class: MethodLog::MethodCommit

Inherits:
Object
  • Object
show all
Defined in:
lib/method_log/method_commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commit, method_definition) ⇒ MethodCommit

Returns a new instance of MethodCommit.



5
6
7
8
# File 'lib/method_log/method_commit.rb', line 5

def initialize(commit, method_definition)
  @commit = commit
  @method_definition = method_definition
end

Instance Attribute Details

#method_definitionObject (readonly)

Returns the value of attribute method_definition.



3
4
5
# File 'lib/method_log/method_commit.rb', line 3

def method_definition
  @method_definition
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/method_log/method_commit.rb', line 14

def ==(other)
  (commit == other.commit) && (method_definition == other.method_definition)
end

#authorObject



26
27
28
# File 'lib/method_log/method_commit.rb', line 26

def author
  commit.author
end

#hashObject



18
19
20
# File 'lib/method_log/method_commit.rb', line 18

def hash
  [commit, method_definition].hash
end

#messageObject



30
31
32
# File 'lib/method_log/method_commit.rb', line 30

def message
  commit.message
end

#method_sourceObject



34
35
36
# File 'lib/method_log/method_commit.rb', line 34

def method_source
  method_definition && method_definition.source + $/
end

#shaObject



22
23
24
# File 'lib/method_log/method_commit.rb', line 22

def sha
  commit.sha
end

#source_fileObject



38
39
40
# File 'lib/method_log/method_commit.rb', line 38

def source_file
  method_definition && method_definition.source_file
end

#update(commit) ⇒ Object



10
11
12
# File 'lib/method_log/method_commit.rb', line 10

def update(commit)
  @commit = commit
end