Class: Flatito::Base
Instance Attribute Summary collapse
Instance Method Summary
collapse
#regex, #value_regex
Methods included from Utils
#truncate
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
23
24
25
26
27
28
29
|
# File 'lib/flatito/renderer.rb', line 23
def initialize(options)
@no_color = options[:no_color] || false
@search = options[:search]
@search_value = options[:search_value]
@case_sensitive = options[:case_sensitive]
@no_color_resolved = nil
end
|
Instance Attribute Details
#case_sensitive ⇒ Object
Returns the value of attribute case_sensitive.
21
22
23
|
# File 'lib/flatito/renderer.rb', line 21
def case_sensitive
@case_sensitive
end
|
#no_color ⇒ Object
Returns the value of attribute no_color.
21
22
23
|
# File 'lib/flatito/renderer.rb', line 21
def no_color
@no_color
end
|
#search ⇒ Object
Returns the value of attribute search.
21
22
23
|
# File 'lib/flatito/renderer.rb', line 21
def search
@search
end
|
#search_value ⇒ Object
Returns the value of attribute search_value.
21
22
23
|
# File 'lib/flatito/renderer.rb', line 21
def search_value
@search_value
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
59
|
# 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?
display_value = truncate_value(item.value)
colorize("=> ", :gray) + matched_value(display_value, :gray)
else
""
end
stdout.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
stdout.puts
stdout.flush
end
|
#print_pathname(pathname) ⇒ Object
35
36
37
|
# File 'lib/flatito/renderer.rb', line 35
def print_pathname(pathname)
stdout.puts colorize(pathname.to_s, :light_blue)
end
|