Class: Git::BlameColor::Formatter
- Inherits:
-
Object
- Object
- Git::BlameColor::Formatter
- Defined in:
- lib/git-blame-color/formatter.rb
Instance Attribute Summary collapse
-
#author_name_width ⇒ Object
readonly
Returns the value of attribute author_name_width.
-
#line_number_width ⇒ Object
readonly
Returns the value of attribute line_number_width.
Instance Method Summary collapse
- #format(commit) ⇒ Object
-
#initialize(author_name_width, line_number_width, options = {}) ⇒ Formatter
constructor
A new instance of Formatter.
- #long_hashes? ⇒ Boolean
- #raw_timestamps? ⇒ Boolean
- #show_boundary_commits? ⇒ Boolean
Constructor Details
#initialize(author_name_width, line_number_width, options = {}) ⇒ Formatter
Returns a new instance of Formatter.
9 10 11 12 13 |
# File 'lib/git-blame-color/formatter.rb', line 9 def initialize(, line_number_width, ={}) @author_name_width = @line_number_width = line_number_width @options = end |
Instance Attribute Details
#author_name_width ⇒ Object (readonly)
Returns the value of attribute author_name_width.
7 8 9 |
# File 'lib/git-blame-color/formatter.rb', line 7 def @author_name_width end |
#line_number_width ⇒ Object (readonly)
Returns the value of attribute line_number_width.
7 8 9 |
# File 'lib/git-blame-color/formatter.rb', line 7 def line_number_width @line_number_width end |
Instance Method Details
#format(commit) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/git-blame-color/formatter.rb', line 27 def format(commit) parts = [ color_coded_hash(commit), Rainbow((commit)).blue, Rainbow((commit)).green, Rainbow(line_number_to_s(commit)).black.bright, commit.edited_line ] parts.join(' ') end |
#long_hashes? ⇒ Boolean
15 16 17 |
# File 'lib/git-blame-color/formatter.rb', line 15 def long_hashes? !!@options[:long_hashes] end |
#raw_timestamps? ⇒ Boolean
23 24 25 |
# File 'lib/git-blame-color/formatter.rb', line 23 def !!@options[:raw_timestamps] end |
#show_boundary_commits? ⇒ Boolean
19 20 21 |
# File 'lib/git-blame-color/formatter.rb', line 19 def show_boundary_commits? @options.include?(:show_boundary_commits) ? !!@options[:show_boundary_commits] : true end |