Bugs: Browse | Submit New | Admin

[#21825] Problem with #escaped_expr

Date:
2008-09-05 08:18
Priority:
3
Submitted By:
Thomas Leitner (gettalong)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Problem with #escaped_expr

Detailed description
Hi,

there is a Ruby constant resolution problem because of how the #escaped_expr(code) method works. It returns a string
containing the value of @escapefunc which contains "Erubis::XmlHelper" for Erubis::Eruby.

When using a class called Erubis, the resolution of the XmlHelper module does not work anymore.

How to reproduce:

require 'erubis'

module MyModule

  class Erubis

    def convert(text)
      ::Erubis::Eruby.new(text).result(binding)
    end

  end

end

MyModule::Erubis.new.convert("<%== 'some < text' %>")

The following error is thrown:
NameError: uninitialized constant MyModule::Erubis::XmlHelper

This seems to come from the string "Erubis::XmlHelper" being evaluated inside MyModule::Erubis.
-- Thomas

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item