Class: Pry::Command::Cat::AbstractFormatter
Instance Method Summary
collapse
#colorize_code, #find_command, #heading, #highlight, #not_a_real_file?, #safe_send, #silence_warnings, #stagger_output, #use_ansi_codes?
#absolute_index_number, #absolute_index_range, #get_method_or_raise, #internal_binding?, #one_index_number, #one_index_range, #one_index_range_or_number, #restrict_to_lines, #set_file_and_dir_locals, #temp_file, #unindent
method_object, #method_object, method_options, #method_options
Instance Method Details
#between_lines ⇒ Object
26
27
28
|
# File 'lib/pry/commands/cat/abstract_formatter.rb', line 26
def between_lines
[opts[:start] || 1, opts[:end] || -1]
end
|
#code_type ⇒ Object
18
19
20
|
# File 'lib/pry/commands/cat/abstract_formatter.rb', line 18
def code_type
opts[:type] || :ruby
end
|
#decorate(content) ⇒ Object
12
13
14
15
16
|
# File 'lib/pry/commands/cat/abstract_formatter.rb', line 12
def decorate(content)
content.code_type = code_type
content.between(*between_lines)
.with_line_numbers(use_line_numbers?).highlighted
end
|
#use_line_numbers? ⇒ Boolean
22
23
24
|
# File 'lib/pry/commands/cat/abstract_formatter.rb', line 22
def use_line_numbers?
opts.present?(:'line-numbers') || opts.present?(:ex)
end
|