+
Skip to content

Reimplement proxy code of ElementProxy to be less severe #127

@dtognazzini

Description

@dtognazzini

ElementProxy undefs a bunch of standard methods on objects:

# Remove all instance methods so even things like class()
# get handled by method_missing(). <lifted from activerecord>
instance_methods.each do |m|
  unless m.to_s =~ /^(?:nil\?|send|object_id|to_a|tap)$|^__|^respond_to/
    undef_method m
  end
end

This undefing is too severe and can cause issues when methods common to most objects are not available. #123 describes an issue with RSpec expectations. Additionally, inspecting instances of ElementProxy in debuggers like Rubymine can sometimes crash the debugger.

Reimplement the proxy code in ElementProxy to be less severe.

Some ideas:

  1. Use SimpleDelegator.
  2. Don't undef any methods.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载