Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using refinements in the sandbox. #35

Open
ghost opened this issue Oct 13, 2017 · 0 comments
Open

Using refinements in the sandbox. #35

ghost opened this issue Oct 13, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 13, 2017

Hello,

I was wondering if it was possible to use refinements within the sandbox.

For example, given this module:

module FooRefinement
  refine String do
    def to_s
      return "bar" if self == "foo"
      super
    end
  end
end

Would it be possible to somehow inject that into the sandboxed code so that when I run this:

s = Sandbox.new
priv = Privileges.new
priv.instances_of(String).allow :to_s
priv.allow_method :puts

s.run(priv, 'puts "foo".to_s')

It outputs "bar" instead of "foo"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants