Class: Flatito::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/flatito/renderer.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
26
27
28
29
|
# File 'lib/flatito/renderer.rb', line 26
def initialize(options)
@no_color = options[:no_color] || false
@search = options[:search]
end
|
Instance Attribute Details
#no_color ⇒ Object
Returns the value of attribute no_color.
24
25
26
|
# File 'lib/flatito/renderer.rb', line 24
def no_color
@no_color
end
|
#search ⇒ Object
Returns the value of attribute search.
24
25
26
|
# File 'lib/flatito/renderer.rb', line 24
def search
@search
end
|
Instance Method Details
#ending ⇒ Object
33
|
# File 'lib/flatito/renderer.rb', line 33
def ending; end
|
#prepare ⇒ Object
31
|
# File 'lib/flatito/renderer.rb', line 31
def prepare; end
|
#print_file_progress(pathname) ⇒ Object
32
|
# File 'lib/flatito/renderer.rb', line 32
def print_file_progress(pathname); end
|
#print_item(item, line_number_padding) ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/flatito/renderer.rb', line 49
def print_item(item, line_number_padding)
line_number = colorize("#{item.line.to_s.rjust(line_number_padding)}: ", :yellow)
value = if item.value.length.positive?
colorize("=> #{item.value}", :gray)
else
""
end
puts "#{line_number} #{matched_string(item.key)} #{value}"
end
|
#print_items(items) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/flatito/renderer.rb', line 39
def print_items(items)
line_number_padding = items.map(&:line).max.to_s.length
items.each do |item|
print_item(item, line_number_padding)
end
puts
flush
end
|
#print_pathname(pathname) ⇒ Object
35
36
37
|
# File 'lib/flatito/renderer.rb', line 35
def print_pathname(pathname)
puts colorize(pathname.to_s, :light_blue)
end
|