Class: GitStats::GitData::CommentStat
- Inherits:
-
Object
- Object
- GitStats::GitData::CommentStat
- Defined in:
- lib/git_stats/git_data/comment_stat.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#deletions ⇒ Object
readonly
Returns the value of attribute deletions.
-
#insertions ⇒ Object
readonly
Returns the value of attribute insertions.
Instance Method Summary collapse
- #changed_lines ⇒ Object
- #escape_characters_in_string(string) ⇒ Object
-
#initialize(commit) ⇒ CommentStat
constructor
A new instance of CommentStat.
Constructor Details
#initialize(commit) ⇒ CommentStat
Returns a new instance of CommentStat.
6 7 8 9 |
# File 'lib/git_stats/git_data/comment_stat.rb', line 6 def initialize(commit) @commit = commit calculate_stat end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
4 5 6 |
# File 'lib/git_stats/git_data/comment_stat.rb', line 4 def commit @commit end |
#deletions ⇒ Object (readonly)
Returns the value of attribute deletions.
4 5 6 |
# File 'lib/git_stats/git_data/comment_stat.rb', line 4 def deletions @deletions end |
#insertions ⇒ Object (readonly)
Returns the value of attribute insertions.
4 5 6 |
# File 'lib/git_stats/git_data/comment_stat.rb', line 4 def insertions @insertions end |
Instance Method Details
#changed_lines ⇒ Object
11 12 13 |
# File 'lib/git_stats/git_data/comment_stat.rb', line 11 def changed_lines insertions + deletions end |
#escape_characters_in_string(string) ⇒ Object
15 16 17 18 |
# File 'lib/git_stats/git_data/comment_stat.rb', line 15 def escape_characters_in_string(string) pattern = %r{['".*/\\-]} string.gsub(pattern) { |match| "\\#{match}" } end |