summaryrefslogtreecommitdiff
path: root/lib/pry
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pry')
-rw-r--r--lib/pry/commands/ls/constants.rb1
-rw-r--r--lib/pry/core_extensions.rb14
-rw-r--r--lib/pry/version.rb2
3 files changed, 14 insertions, 3 deletions
diff --git a/lib/pry/commands/ls/constants.rb b/lib/pry/commands/ls/constants.rb
index 6889075f..8ba5c83a 100644
--- a/lib/pry/commands/ls/constants.rb
+++ b/lib/pry/commands/ls/constants.rb
@@ -4,6 +4,7 @@ class Pry
class Command::Ls < Pry::ClassCommand
class Constants < Pry::Command::Ls::Formatter
DEPRECATED_CONSTANTS = [:Fixnum, :Bignum, :TimeoutError, :NIL, :FALSE, :TRUE]
+ DEPRECATED_CONSTANTS << :JavaPackageModuleTemplate if Pry::Helpers::BaseHelpers.jruby?
include Pry::Command::Ls::Interrogatable
def initialize(interrogatee, no_user_opts, opts, _pry_)
diff --git a/lib/pry/core_extensions.rb b/lib/pry/core_extensions.rb
index a418daf3..cba74c25 100644
--- a/lib/pry/core_extensions.rb
+++ b/lib/pry/core_extensions.rb
@@ -68,12 +68,22 @@ class Object
def __binding__
# If you ever feel like changing this method, be careful about variables
# that you use. They shouldn't be inserted into the binding that will
- # eventually be returning.
+ # eventually be returned.
# When you're cd'd into a class, methods you define should be added to it.
if is_a?(Module)
+ # A special case, for JRuby.
+ # Module.new.class_eval("binding") has different behaviour than CRuby,
+ # where this is not needed: class_eval("binding") vs class_eval{binding}.
+ # Using a block works around the difference of behaviour on JRuby.
+ # The scope is clear of local variabless. Don't add any.
+ #
+ # This fixes the following two spec failures, at https://travis-ci.org/pry/pry/jobs/274470002
+ # 1) ./spec/pry_spec.rb:360:in `block in (root)'
+ # 2) ./spec/pry_spec.rb:366:in `block in (root)'
+ return class_eval {binding} if Pry::Helpers::BaseHelpers.jruby? and self.name == nil
# class_eval sets both self and the default definee to this class.
- return class_eval "binding"
+ return class_eval("binding")
end
unless respond_to?(:__pry__)
diff --git a/lib/pry/version.rb b/lib/pry/version.rb
index e0d2304a..2712f945 100644
--- a/lib/pry/version.rb
+++ b/lib/pry/version.rb
@@ -1,3 +1,3 @@
class Pry
- VERSION = "0.10.4"
+ VERSION = "0.11.0"
end