Class: Blammo::Commit
- Inherits:
-
Object
- Object
- Blammo::Commit
- Defined in:
- lib/blammo/commit.rb
Constant Summary collapse
- COMMIT_RE =
/^(\[\w+\]) (.*)/
- TAGS_RE_MAP =
{ :added => /(ADDED|NEW)/, :changed => /(CHANGED)/, :fixed => /(FIXED)/, }
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(sha, message) ⇒ Commit
constructor
A new instance of Commit.
- #to_s ⇒ Object
- #to_yaml(options = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
11 12 13 |
# File 'lib/blammo/commit.rb', line 11 def @message end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
11 12 13 |
# File 'lib/blammo/commit.rb', line 11 def sha @sha end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
11 12 13 |
# File 'lib/blammo/commit.rb', line 11 def tag @tag end |
Class Method Details
.parse_tag(value) ⇒ Object
35 36 37 38 |
# File 'lib/blammo/commit.rb', line 35 def self.parse_tag(value) tag, regexp = TAGS_RE_MAP.detect {|tag, regexp| value =~ regexp} tag end |
Instance Method Details
#to_s ⇒ Object
21 22 23 |
# File 'lib/blammo/commit.rb', line 21 def to_s @message end |
#to_yaml(options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/blammo/commit.rb', line 25 def to_yaml( = {}) = "[#{@tag.to_s.upcase}] #{@message}" if @sha {@sha => } else end.to_yaml() end |