pry-developer_tools 0.1.0.pre2 → 0.1.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,18 +57,12 @@ module PryDeveloperTools
57
57
  Edit a Pry command.
58
58
  BANNER
59
59
 
60
- def initialize env
61
- @pry = env[:pry_instance]
62
- @command = nil
63
- super(env)
64
- end
65
-
66
60
  def options(opt)
67
61
  opt.on :p, :patch, 'Perform a in-memory edit of a command'
68
62
  end
69
63
 
70
64
  def process
71
- @command = @pry.commands.find_command(args.first)
65
+ @command, @_target = find_command_and_target
72
66
 
73
67
  if @command.nil?
74
68
  raise Pry::CommandError, 'Command not found.'
@@ -82,8 +76,23 @@ module PryDeveloperTools
82
76
  end
83
77
  end
84
78
 
79
+ def find_command_and_target
80
+ raw = args.first
81
+
82
+ if raw.include?('#')
83
+ command, method = raw.split('#', 2)
84
+ command = _pry_.commands.find_command(command)
85
+ target = command.instance_method(method)
86
+ else
87
+ command = _pry_.commands.find_command(str)
88
+ target = command.block
89
+ end
90
+
91
+ [command, target]
92
+ end
93
+
85
94
  def edit_permanently
86
- file, lineno = @command.block.source_location
95
+ file, lineno = @_target.source_location
87
96
  invoke_editor(file, lineno)
88
97
 
89
98
  command_set = silence_warnings do
@@ -95,13 +104,13 @@ module PryDeveloperTools
95
104
  "Expected file '#{file}' to return a CommandSet"
96
105
  end
97
106
 
98
- @pry.commands.delete(@command.name)
99
- @pry.commands.import(command_set)
107
+ _pry_.commands.delete(@command.name)
108
+ _pry_.commands.import(command_set)
100
109
  set_file_and_dir_locals(file)
101
110
  end
102
111
 
103
112
  def edit_temporarily
104
- source_code = Pry::Method(@command.block).source
113
+ source_code = Pry::Method(@_target).source
105
114
  modified_code = nil
106
115
 
107
116
  temp_file do |f|
@@ -119,8 +128,8 @@ module PryDeveloperTools
119
128
  end
120
129
  end
121
130
 
122
- @pry.commands.delete(@command.name)
123
- @pry.commands.import(command_set)
131
+ _pry_.commands.delete(@command.name)
132
+ _pry_.commands.import(command_set)
124
133
  end
125
134
  end
126
135
  end
@@ -1,3 +1,3 @@
1
1
  module PryDeveloperTools
2
- VERSION = '0.1.0.pre2'
2
+ VERSION = '0.1.0.pre3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-developer_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre2
4
+ version: 0.1.0.pre3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-20 00:00:00.000000000 Z
12
+ date: 2012-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
16
- requirement: &70338629277220 !ruby/object:Gem::Requirement
16
+ requirement: &70129170439620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.8.pre
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70338629277220
24
+ version_requirements: *70129170439620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70338629276640 !ruby/object:Gem::Requirement
27
+ requirement: &70129170438700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70338629276640
35
+ version_requirements: *70129170438700
36
36
  description: A collection of developer tools for Pry users
37
37
  email: rob@flowof.info
38
38
  executables: []
@@ -61,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  segments:
63
63
  - 0
64
- hash: 94940989689613245
64
+ hash: -1266989099645572674
65
65
  required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements: