Class: MethodMatch::Pry

Inherits:
Object
  • Object
show all
Defined in:
lib/method_match/pry.rb

Constant Summary collapse

PRY_PACKAGE =
'pry'
COMMAND_NAME =
"rspec_method"
COMMAND_DESCRIPTION =
"runs spec given name and line number"

Instance Method Summary collapse

Instance Method Details

#command_procObject



13
14
15
16
17
18
19
20
21
# File 'lib/method_match/pry.rb', line 13

def command_proc
  Proc.new do
    def process(*args)
      CommandRunner.new(
        Matcher.new(args[0], Integer(args[1]))
      ).run_command
    end
  end
end

#rspec_methodObject



7
8
9
10
11
# File 'lib/method_match/pry.rb', line 7

def rspec_method
  Proc.new do
    create_command COMMAND_NAME, COMMAND_DESCRIPTION, &MethodMatch::Pry.new.command_proc
  end
end

#setupObject



23
24
25
26
# File 'lib/method_match/pry.rb', line 23

def setup
  require PRY_PACKAGE
  ::Pry::CommandSet.new(&rspec_method).tap { |cmd| ::Pry::Commands.import cmd }
end