Class: IRT::Log::Hunk
- Inherits:
-
Array
show all
- Defined in:
- lib/irt/hunks.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(header) ⇒ Hunk
Returns a new instance of Hunk.
8
9
10
|
# File 'lib/irt/hunks.rb', line 8
def initialize()
@header =
end
|
Instance Attribute Details
Returns the value of attribute color.
6
7
8
|
# File 'lib/irt/hunks.rb', line 6
def color
@color
end
|
Returns the value of attribute header.
6
7
8
|
# File 'lib/irt/hunks.rb', line 6
def
@header
end
|
Instance Method Details
#add_line(content, line_no) ⇒ Object
12
13
14
|
# File 'lib/irt/hunks.rb', line 12
def add_line(content, line_no)
self << [content.chomp, line_no]
end
|
35
36
37
|
# File 'lib/irt/hunks.rb', line 35
def
@header
end
|
49
50
51
|
# File 'lib/irt/hunks.rb', line 49
def inspect
%(<#{self.class.name} #{}>)
end
|
#last_line_no ⇒ Object
31
32
33
|
# File 'lib/irt/hunks.rb', line 31
def last_line_no
last && last[1]
end
|
#lines_str ⇒ Object
27
28
29
|
# File 'lib/irt/hunks.rb', line 27
def lines_str
map{|content, line_no| content }.join("\n")
end
|
#render(wanted = nil) ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/irt/hunks.rb', line 16
def render(wanted=nil)
return unless size > 0
Log.print_border
wanted ||= size
last(wanted).each do |content, line_no|
Log.print_border
render_line(content, line_no)
end
end
|
39
40
41
|
# File 'lib/irt/hunks.rb', line 39
def
puts IRT.dye(" #{} ", "***** #{} *****", color, :bold, :reversed)
end
|
#render_line(content, line_no) ⇒ Object
43
44
45
46
47
|
# File 'lib/irt/hunks.rb', line 43
def render_line(content, line_no)
lcontent = IRT.dye content, color
lno = IRT.dye(('%3d ' % line_no), color, :reversed)
puts "#{lno} #{lcontent}"
end
|