diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2018-10-13 01:46:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-13 01:46:57 +0800 |
commit | 4f121a6a07a94dd5f7a71e75a406147d9d21568d (patch) | |
tree | cd60b5c52be027d464f3646508e78d352e1a0d96 /lib/pry | |
parent | 6794ce504db64b5a188ef4275964906fc79067b8 (diff) | |
parent | ac9ddde444623c64539ee1ed2fefef31c6e99995 (diff) | |
download | pry-4f121a6a07a94dd5f7a71e75a406147d9d21568d.tar.gz |
Merge pull request #1797 from pry/rubocop-layout-end-alignment
rubocop: fix offences of the Layout/EndAlignment cop
Diffstat (limited to 'lib/pry')
-rw-r--r-- | lib/pry/commands/find_method.rb | 7 | ||||
-rw-r--r-- | lib/pry/commands/hist.rb | 3 | ||||
-rw-r--r-- | lib/pry/editor.rb | 7 | ||||
-rw-r--r-- | lib/pry/method.rb | 23 |
4 files changed, 17 insertions, 23 deletions
diff --git a/lib/pry/commands/find_method.rb b/lib/pry/commands/find_method.rb index 52535c17..81de21cb 100644 --- a/lib/pry/commands/find_method.rb +++ b/lib/pry/commands/find_method.rb @@ -33,12 +33,7 @@ class Pry return if args.size < 1 klass = search_class - matches = if opts.content? - content_search(klass) - else - name_search(klass) - end - + matches = opts.content? ? content_search(klass) : name_search(klass) show_search_results(matches) end diff --git a/lib/pry/commands/hist.rb b/lib/pry/commands/hist.rb index 4bbf2a20..a1ca241a 100644 --- a/lib/pry/commands/hist.rb +++ b/lib/pry/commands/hist.rb @@ -43,7 +43,8 @@ class Pry @history = @history.grep(opts[:grep]) end - @history = case + @history = + case when opts.present?(:head) @history.take_lines(1, opts[:head] || 10) when opts.present?(:tail) diff --git a/lib/pry/editor.rb b/lib/pry/editor.rb index f1869d2c..9acdbe39 100644 --- a/lib/pry/editor.rb +++ b/lib/pry/editor.rb @@ -43,12 +43,7 @@ class Pry args = [file, line, blocking][0...(_pry_.config.editor.arity)] _pry_.config.editor.call(*args) else - sanitized_file = if windows? - file - else - Shellwords.escape(file) - end - + sanitized_file = windows? ? file : Shellwords.escape(file) "#{_pry_.config.editor} #{blocking_flag_for_editor(blocking)} #{start_line_syntax_for_editor(sanitized_file, line)}" end end diff --git a/lib/pry/method.rb b/lib/pry/method.rb index bad95d02..3fb5da7f 100644 --- a/lib/pry/method.rb +++ b/lib/pry/method.rb @@ -298,7 +298,8 @@ class Pry # @return [String, nil] The documentation for the method, or `nil` if it's # unavailable. def doc - @doc ||= case source_type + @doc ||= + case source_type when :c info = pry_doc_info info.docstring if info @@ -361,15 +362,17 @@ class Pry if respond_to?(:parameters) args = parameters.inject([]) do |args_array, (arg_type, name)| name ||= (arg_type == :block ? 'block' : "arg#{args_array.size + 1}") - args_array << case arg_type - when :req then name.to_s - when :opt then "#{name}=?" - when :rest then "*#{name}" - when :block then "&#{name}" - when :key then "#{name}:?" - when :keyreq then "#{name}:" - else '?' - end + args_array.push( + case arg_type + when :req then name.to_s + when :opt then "#{name}=?" + when :rest then "*#{name}" + when :block then "&#{name}" + when :key then "#{name}:?" + when :keyreq then "#{name}:" + else '?' + end + ) end else args = (1..arity.abs).map { |i| "arg#{i}" } |