pry 0.7.1-i386-mingw32 → 0.7.2-i386-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -47,7 +47,7 @@ end
47
47
  namespace :ruby do
48
48
  spec = Gem::Specification.new do |s|
49
49
  apply_spec_defaults(s)
50
- s.add_dependency("method_source",">=0.3.4")
50
+ s.add_dependency("method_source",">=0.4.0")
51
51
  s.platform = Gem::Platform::RUBY
52
52
  end
53
53
 
@@ -61,7 +61,7 @@ end
61
61
  namespace v do
62
62
  spec = Gem::Specification.new do |s|
63
63
  apply_spec_defaults(s)
64
- s.add_dependency("method_source",">=0.3.4")
64
+ s.add_dependency("method_source",">=0.4.0")
65
65
  s.add_dependency("win32console", ">=1.3.0")
66
66
  s.platform = "i386-#{v}"
67
67
  end
data/lib/pry/commands.rb CHANGED
@@ -321,7 +321,7 @@ Shows local and instance variables by default.
321
321
 
322
322
  # plain
323
323
  else
324
- list = info.values.sort_by { |v| v.last }.map { |v| v.first }.inject(&:+)
324
+ list = info.values.sort_by(&:last).map(&:first).inject(&:+)
325
325
  list.uniq! if list
326
326
  if Pry.color
327
327
  output.puts CodeRay.scan(Pry.view(list), :ruby).term
@@ -6,6 +6,11 @@ class Pry
6
6
 
7
7
  attr_accessor *CONFIG_OPTIONS
8
8
 
9
+ # Returns the target binding for the session. Note that altering this
10
+ # attribute will not change the target binding.
11
+ # @return [Binding] The target object for the session
12
+ attr_accessor :session_target
13
+
9
14
  # Create a new `Pry` object.
10
15
  # @param [Hash] options The optional configuration parameters.
11
16
  # @option options [#readline] :input The object to use for input.
@@ -61,6 +66,36 @@ class Pry
61
66
  hooks[hook_name].call(*args, &block) if hooks[hook_name]
62
67
  end
63
68
 
69
+ # Initialize the repl session.
70
+ # @param [Binding] target The target binding for the session.
71
+ def repl_prologue(target)
72
+ exec_hook :before_session, output, target
73
+ Pry.active_instance = self
74
+
75
+ # Make sure special locals exist
76
+ target.eval("_pry_ = Pry.active_instance")
77
+ target.eval("_ = Pry.last_result")
78
+ self.session_target = target
79
+ end
80
+
81
+ # Clean-up after the repl session.
82
+ # @param [Binding] target The target binding for the session.
83
+ # @return [Object] The return value of the repl session (if one exists).
84
+ def repl_epilogue(target, nesting_level, break_data)
85
+ nesting.pop
86
+ exec_hook :after_session, output, target
87
+
88
+ # If break_data is an array, then the last element is the return value
89
+ break_level, return_value = Array(break_data)
90
+
91
+ # keep throwing until we reach the desired nesting level
92
+ if nesting_level != break_level
93
+ throw :breakout, break_data
94
+ end
95
+
96
+ return_value
97
+ end
98
+
64
99
  # Start a read-eval-print-loop.
65
100
  # If no parameter is given, default to top-level (main).
66
101
  # @param [Object, Binding] target The receiver of the Pry session
@@ -73,18 +108,12 @@ class Pry
73
108
  target = Pry.binding_for(target)
74
109
  target_self = target.eval('self')
75
110
 
76
- exec_hook :before_session, output, target
77
-
111
+ repl_prologue(target)
112
+
78
113
  # cannot rely on nesting.level as
79
114
  # nesting.level changes with new sessions
80
115
  nesting_level = nesting.size
81
116
 
82
- Pry.active_instance = self
83
-
84
- # Make sure special locals exist
85
- target.eval("_pry_ = Pry.active_instance")
86
- target.eval("_ = Pry.last_result")
87
-
88
117
  break_data = catch(:breakout) do
89
118
  nesting.push [nesting.size, target_self, self]
90
119
  loop do
@@ -92,17 +121,7 @@ class Pry
92
121
  end
93
122
  end
94
123
 
95
- nesting.pop
96
-
97
- exec_hook :after_session, output, target
98
-
99
- # If break_data is an array, then the last element is the return value
100
- break_level, return_value = Array(break_data)
101
-
102
- # keep throwing until we reach the desired nesting level
103
- if nesting_level != break_level
104
- throw :breakout, break_data
105
- end
124
+ return_value = repl_epilogue(target, nesting_level, break_data)
106
125
 
107
126
  # if one was provided, return the return value
108
127
  return return_value if return_value
data/lib/pry/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 1
9
- version: 0.7.1
8
+ - 2
9
+ version: 0.7.2
10
10
  platform: i386-mingw32
11
11
  authors:
12
12
  - John Mair (banisterfiend)
@@ -72,9 +72,9 @@ dependencies:
72
72
  - !ruby/object:Gem::Version
73
73
  segments:
74
74
  - 0
75
- - 3
76
75
  - 4
77
- version: 0.3.4
76
+ - 0
77
+ version: 0.4.0
78
78
  type: :runtime
79
79
  version_requirements: *id004
80
80
  - !ruby/object:Gem::Dependency