diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2019-02-25 02:16:10 +0200 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2019-02-25 02:21:54 +0200 |
commit | 9e783ae9af968d4c628cdc6a952e75f5e99a0629 (patch) | |
tree | e9901ccf548c278aa2ad006d365b26f845469b2a /lib | |
parent | 3bc48e3828f2e622788be8f67aaf0f53fd801f95 (diff) | |
download | pry-9e783ae9af968d4c628cdc6a952e75f5e99a0629.tar.gz |
rubocop: fix the Layout/MultilineOperationIndentation cop
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pry/commands/edit.rb | 3 | ||||
-rw-r--r-- | lib/pry/commands/ls.rb | 4 | ||||
-rw-r--r-- | lib/pry/commands/ls/constants.rb | 4 | ||||
-rw-r--r-- | lib/pry/commands/whereami.rb | 10 | ||||
-rw-r--r-- | lib/pry/helpers/table.rb | 5 | ||||
-rw-r--r-- | lib/pry/method/weird_method_locator.rb | 6 | ||||
-rw-r--r-- | lib/pry/pry_instance.rb | 4 | ||||
-rw-r--r-- | lib/pry/slop/option.rb | 4 | ||||
-rw-r--r-- | lib/pry/wrapped_module.rb | 4 |
9 files changed, 23 insertions, 21 deletions
diff --git a/lib/pry/commands/edit.rb b/lib/pry/commands/edit.rb index f9b46707..0e138526 100644 --- a/lib/pry/commands/edit.rb +++ b/lib/pry/commands/edit.rb @@ -135,7 +135,8 @@ class Pry end def code_object - @code_object ||= !probably_a_file?(filename_argument) && + @code_object ||= + !probably_a_file?(filename_argument) && Pry::CodeObject.lookup(filename_argument, _pry_) end diff --git a/lib/pry/commands/ls.rb b/lib/pry/commands/ls.rb index 2e24cd11..515dfd8e 100644 --- a/lib/pry/commands/ls.rb +++ b/lib/pry/commands/ls.rb @@ -55,8 +55,8 @@ class Pry opt.on :v, :verbose, "Show methods and constants on all super-classes (ignores Pry.config.ls.ceiling)" opt.on :g, :globals, "Show global variables, including those builtin to Ruby (in cyan)" opt.on :l, :locals, "Show hash of local vars, sorted by descending size" - opt.on :c, :constants, "Show constants, highlighting classes (in blue), and exceptions (in purple).\n" << - " " * 32 << "Constants that are pending autoload? are also shown (in yellow)" + opt.on :c, :constants, "Show constants, highlighting classes (in blue), and exceptions (in purple).\n" \ + "#{' ' * 32}Constants that are pending autoload? are also shown (in yellow)" opt.on :i, :ivars, "Show instance variables (in blue) and class variables (in bright blue)" opt.on :G, :grep, "Filter output by regular expression", argument: true if Object.respond_to?(:deprecate_constant) diff --git a/lib/pry/commands/ls/constants.rb b/lib/pry/commands/ls/constants.rb index 88785e75..d969eefa 100644 --- a/lib/pry/commands/ls/constants.rb +++ b/lib/pry/commands/ls/constants.rb @@ -35,8 +35,8 @@ class Pry def format(mod, constants) constants.sort_by(&:downcase).map do |name| if Object.respond_to?(:deprecate_constant) && - DEPRECATED_CONSTANTS.include?(name) && - !show_deprecated_constants? + DEPRECATED_CONSTANTS.include?(name) && + !show_deprecated_constants? next end diff --git a/lib/pry/commands/whereami.rb b/lib/pry/commands/whereami.rb index fcc5760e..67764712 100644 --- a/lib/pry/commands/whereami.rb +++ b/lib/pry/commands/whereami.rb @@ -98,10 +98,12 @@ class Pry set_file_and_dir_locals(@file) - out = "\n#{bold('From:')} #{location}:\n\n" << - code.with_line_numbers(use_line_numbers?).with_marker(marker).highlighted << "\n" - - _pry_.pager.page out + pretty_code = code.with_line_numbers(use_line_numbers?) + .with_marker(marker) + .highlighted + _pry_.pager.page( + "\n#{bold('From:')} #{location}:\n\n" << pretty_code << "\n" + ) end private diff --git a/lib/pry/helpers/table.rb b/lib/pry/helpers/table.rb index 410d0b03..6a82ddab 100644 --- a/lib/pry/helpers/table.rb +++ b/lib/pry/helpers/table.rb @@ -23,8 +23,9 @@ class Pry def self.tablify(things, line_length, config = Pry.config) table = Table.new(things, { column_count: things.size }, config) - table.column_count -= 1 until (1 == table.column_count) || - table.fits_on_line?(line_length) + until (1 == table.column_count) || table.fits_on_line?(line_length) + table.column_count -= 1 + end table end diff --git a/lib/pry/method/weird_method_locator.rb b/lib/pry/method/weird_method_locator.rb index a3aa109a..6bf3c87f 100644 --- a/lib/pry/method/weird_method_locator.rb +++ b/lib/pry/method/weird_method_locator.rb @@ -31,7 +31,7 @@ class Pry binding_file, binding_line = b.eval('__FILE__'), b.eval('__LINE__') end (File.expand_path(method.source_file) == File.expand_path(binding_file)) && - method.source_range.include?(binding_line) + method.source_range.include?(binding_line) end rescue false @@ -186,8 +186,8 @@ class Pry Pry::Method.method_definition?(method.name, v) end - @original_method_source_location = source_index && - [target_file, index_to_line_number(source_index)] + @original_method_source_location = + source_index && [target_file, index_to_line_number(source_index)] end def index_to_line_number(index) diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index bd1d7c83..d9fab1df 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -396,8 +396,8 @@ class Pry # Force `eval_string` into the encoding of `val`. [Issue #284] def ensure_correct_encoding!(val) if @eval_string.empty? && - val.respond_to?(:encoding) && - val.encoding != @eval_string.encoding + val.respond_to?(:encoding) && + val.encoding != @eval_string.encoding @eval_string.force_encoding(val.encoding) end end diff --git a/lib/pry/slop/option.rb b/lib/pry/slop/option.rb index 2f2e060c..98a1e3fd 100644 --- a/lib/pry/slop/option.rb +++ b/lib/pry/slop/option.rb @@ -142,8 +142,8 @@ class Pry::Slop # Returns the String inspection text. def inspect - "#<Slop::Option [-#{short} | --#{long}" + - "#{'=' if expects_argument?}#{'=?' if accepts_optional_argument?}]" + + "#<Slop::Option [-#{short} | --#{long}" \ + "#{'=' if expects_argument?}#{'=?' if accepts_optional_argument?}]" \ " (#{description}) #{config.inspect}" end diff --git a/lib/pry/wrapped_module.rb b/lib/pry/wrapped_module.rb index 31f1c010..59879985 100644 --- a/lib/pry/wrapped_module.rb +++ b/lib/pry/wrapped_module.rb @@ -287,9 +287,7 @@ class Pry # candidate of rank 0 will be returned, or a CommandError raised if # there are no candidates at all. def primary_candidate - @primary_candidate ||= candidates.find { |c| c.file } || - # This will raise an exception if there is no candidate at all. - candidate(0) + @primary_candidate ||= candidates.find { |c| c.file } || candidate(0) end # @return [Array<Array<Pry::Method>>] The array of `Pry::Method` objects, |