mirror of
https://github.com/rubyjs/therubyrhino
synced 2023-03-27 23:21:34 -04:00
17 lines
258 B
Ruby
17 lines
258 B
Ruby
|
|
class Object
|
|
|
|
unless method_defined?(:tap)
|
|
def tap # :nodoc:
|
|
yield self
|
|
self
|
|
end
|
|
end
|
|
|
|
def eval_js(source, options = {})
|
|
Rhino::Context.open(options.merge(:with => self)) do |cxt|
|
|
cxt.eval(source)
|
|
end
|
|
end
|
|
|
|
end
|