Class: Flatito::Base
Instance Attribute Summary collapse
Instance Method Summary
collapse
#regex
Methods included from Utils
#truncate
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
24
25
26
27
|
# File 'lib/flatito/renderer.rb', line 24
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.
22
23
24
|
# File 'lib/flatito/renderer.rb', line 22
def no_color
@no_color
end
|
#search ⇒ Object
Returns the value of attribute search.
22
23
24
|
# File 'lib/flatito/renderer.rb', line 22
def search
@search
end
|
Instance Method Details
#ending ⇒ Object
31
|
# File 'lib/flatito/renderer.rb', line 31
def ending; end
|
#prepare ⇒ Object
29
|
# File 'lib/flatito/renderer.rb', line 29
def prepare; end
|
#print_file_progress(pathname) ⇒ Object
30
|
# File 'lib/flatito/renderer.rb', line 30
def print_file_progress(pathname); end
|
#print_item(item, line_number_padding) ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/flatito/renderer.rb', line 47
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
stdout.puts "#{line_number} #{matched_string(item.key)} #{value}"
end
|
#print_items(items) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/flatito/renderer.rb', line 37
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
stdout.puts
stdout.flush
end
|
#print_pathname(pathname) ⇒ Object
33
34
35
|
# File 'lib/flatito/renderer.rb', line 33
def print_pathname(pathname)
stdout.puts colorize(pathname.to_s, :light_blue)
end
|