Class: MethodLog::MethodCommit
- Inherits:
-
Object
- Object
- MethodLog::MethodCommit
- Defined in:
- lib/method_log/method_commit.rb
Instance Attribute Summary collapse
-
#method_definition ⇒ Object
readonly
Returns the value of attribute method_definition.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #author ⇒ Object
- #hash ⇒ Object
-
#initialize(commit, method_definition) ⇒ MethodCommit
constructor
A new instance of MethodCommit.
- #message ⇒ Object
- #method_source ⇒ Object
- #sha ⇒ Object
- #source_file ⇒ Object
- #to_s ⇒ Object
- #update(commit) ⇒ Object
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_definition ⇒ Object (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 |
#author ⇒ Object
26 27 28 |
# File 'lib/method_log/method_commit.rb', line 26 def commit. end |
#hash ⇒ Object
18 19 20 |
# File 'lib/method_log/method_commit.rb', line 18 def hash [commit, method_definition].hash end |
#message ⇒ Object
30 31 32 |
# File 'lib/method_log/method_commit.rb', line 30 def commit. end |
#method_source ⇒ Object
34 35 36 |
# File 'lib/method_log/method_commit.rb', line 34 def method_source method_definition && method_definition.source + $/ end |
#sha ⇒ Object
22 23 24 |
# File 'lib/method_log/method_commit.rb', line 22 def sha commit.sha end |
#source_file ⇒ Object
38 39 40 |
# File 'lib/method_log/method_commit.rb', line 38 def source_file method_definition && method_definition.source_file end |
#to_s ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/method_log/method_commit.rb', line 42 def to_s [ "commit #{sha}", "Author: #{[:name]} <#{[:email]}>", "Date: #{[:time].strftime('%a %b %-e %T %Y %z')}", '', ].join($/) end |
#update(commit) ⇒ Object
10 11 12 |
# File 'lib/method_log/method_commit.rb', line 10 def update(commit) @commit = commit end |