lib/pry-singular.rb in pry-singular-0.1.4 vs lib/pry-singular.rb in pry-singular-0.1.5
- old
+ new
@@ -1,7 +1,8 @@
-require "pry-singular/version"
+require 'pry-singular/version'
require 'pry-singular/extract_pry_singular_options'
+require 'pry-singular/parse_readline'
require 'pry'
module PrySingular
class << self
def set_class(*klasses)
@@ -23,11 +24,11 @@
singular_methods = adapt_options_singleton_methods(klass, options)
set_pry_command do
singular_methods.each do |klass_method|
command "#{klass_method}", "#{klass}.#{klass_method}" do
klass.class_eval <<-EOS
- #{parse_readline!(Readline::HISTORY.to_a.last)}
+ #{parse_singular_method_command(Readline::HISTORY.to_a.last)}
EOS
end
end
end
end
@@ -39,14 +40,10 @@
def adapt_options_singleton_methods(klass, options)
if options[:only].any?
return options[:only].select { |method_name| klass.respond_to?(method_name) }
end
- klass.singleton_methods - options[:except]
- end
- def parse_readline!(readline_history_element)
- method, args = readline_history_element.split(" ", 2)
- method + ' ' + args.gsub(' ', '')
+ klass.singleton_methods - options[:except]
end
end
end