-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Hey, after upgrading from JRuby 1.7.22 to JRuby 9.0.1.0 I found, that warden is raising errors when logging user in. So I was digging a little bit and found, that there's inconsistency in behaviour between ruby versions.
Let me describe it on the following code (working subset from warden gem):
class SessionSerializer
def serialize(obj)
obj
end
end
class Manager
def self.serialize_into_session(&block)
SessionSerializer.send :define_method, :serialize, &block
end
endAnd now how it behaves on JRuby 1.7.22 and MRI 2.2.2
Manager.serialize_into_session { |obj| obj.to_s } # => :serialize
SessionSerializer.new.serialize(1) # => 1Manager.serialize_into_session(&:to_s) # => :serialize
SessionSerializer.new.serialize(1) # => 1So the result is as expected, but now what about JRuby 9.0.1.0:
Manager.serialize_into_session { |obj| obj.to_s } # => :serialize
SessionSerializer.new.serialize(1) # => 1Manager.serialize_into_session(&:to_s) # => :serialize
SessionSerializer.new.serialize(1) # ArgumentError: wrong number of arguments (1 for 0)Hope this helps to identify this define_method inconsistency.
Reactions are currently unavailable