lib/unextendable/object.rb in unextendable-0.1.4 vs lib/unextendable/object.rb in unextendable-0.1.5
- old
+ new
@@ -45,10 +45,17 @@
return if @wrapped_respond_to
instance_eval <<-CODE
def respond_to?(symbol, include_private = false)
- meta_class.extended_modules.detect{|x| x.instance_methods.collect(&:to_s).include? symbol.to_s} || meta_class.method_procs[symbol.to_s].class == Proc
+ meta_class.extended_modules.any?{|x| x.instance_methods.collect(&:to_s).include? symbol.to_s} ||
+ begin
+ if meta_class.method_procs.has_key? symbol.to_s
+ meta_class.method_procs[symbol.to_s].class == Proc
+ else
+ self.class.instance_methods.collect(&:to_s).include? symbol.to_s
+ end
+ end
end
CODE
@wrapped_respond_to = true
end
\ No newline at end of file