Class: CommitCommentTools::Entry
- Inherits:
-
Object
- Object
- CommitCommentTools::Entry
- Defined in:
- lib/commit-comment-tools/entry.rb
Defined Under Namespace
Classes: InvalidEntryError
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#read_ratio ⇒ Object
readonly
Returns the value of attribute read_ratio.
Instance Method Summary collapse
-
#initialize(name, entry_chunk) ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(name, entry_chunk) ⇒ Entry
Returns a new instance of Entry.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/commit-comment-tools/entry.rb', line 27 def initialize(name, entry_chunk) @name = name @date = nil @read_ratio = nil @comment = nil if /\A(\d\d\d\d-\d+-\d+):(\d+)%:(.*)\z/m =~ entry_chunk @date = Date.parse($1).strftime("%Y-%m-%d") @read_ratio = $2.to_i @comment = $3 else valid_format = "DATE:READ_RATIO%:COMMENT" = "The expected format of entry like below:\n" + "\"#{valid_format}\", but was \"#{entry_chunk}\"." raise(InvalidEntryError, ) end end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
25 26 27 |
# File 'lib/commit-comment-tools/entry.rb', line 25 def comment @comment end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
25 26 27 |
# File 'lib/commit-comment-tools/entry.rb', line 25 def date @date end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/commit-comment-tools/entry.rb', line 25 def name @name end |
#read_ratio ⇒ Object (readonly)
Returns the value of attribute read_ratio.
25 26 27 |
# File 'lib/commit-comment-tools/entry.rb', line 25 def read_ratio @read_ratio end |