Class: Markout::Revision
- Inherits:
-
Object
- Object
- Markout::Revision
- Defined in:
- lib/markout/revision.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #diff(options = {}) ⇒ Object
-
#initialize(repo, commit) ⇒ Revision
constructor
A new instance of Revision.
- #message(options = {}) ⇒ Object
Constructor Details
#initialize(repo, commit) ⇒ Revision
Returns a new instance of Revision.
9 10 11 12 13 14 15 16 |
# File 'lib/markout/revision.rb', line 9 def initialize(repo, commit) @repo = repo @sha = commit.sha @date = commit.date @author = commit..to_s @subject, @message = (commit) @diff = commit.show.first.diff || '' end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
7 8 9 |
# File 'lib/markout/revision.rb', line 7 def @author end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
7 8 9 |
# File 'lib/markout/revision.rb', line 7 def date @date end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
7 8 9 |
# File 'lib/markout/revision.rb', line 7 def sha @sha end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
7 8 9 |
# File 'lib/markout/revision.rb', line 7 def subject @subject end |
Instance Method Details
#diff(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/markout/revision.rb', line 18 def diff(={}) case [:format] when 'raw' then @diff when 'short' then short_diff when 'inline' then inline_diff else @diff end end |
#message(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/markout/revision.rb', line 27 def (={}) case [:format] when :html return RDiscount.new(@message).to_html else return @message end end |