mirror of
https://github.com/rubyjs/therubyrhino
synced 2023-03-27 23:21:34 -04:00
add docs for the options to open
This commit is contained in:
parent
5a9bb13d9f
commit
9ca6bb7374
1 changed files with 13 additions and 4 deletions
|
@ -45,6 +45,10 @@ module Rhino
|
|||
|
||||
end
|
||||
|
||||
# Create a new javascript environment for executing javascript and ruby code.
|
||||
# * <tt>:sealed</tt> - if this is true, then the standard objects such as Object, Function, Array will not be able to be modified
|
||||
# * <tt>:with</tt> - use this ruby object as the root scope for all javascript that is evaluated
|
||||
# * <tt>:java</tt> - if true, java packages will be accessible from within javascript
|
||||
def initialize(options = {}) #:nodoc:
|
||||
ContextFactory.new.call do |native|
|
||||
@native = native
|
||||
|
@ -92,10 +96,6 @@ module Rhino
|
|||
end if open?
|
||||
end
|
||||
|
||||
def open?
|
||||
@native == J::Context.getCurrentContext() || (raise ContextError, "context must be open")
|
||||
end
|
||||
|
||||
# Read the contents of <tt>filename</tt> and evaluate it as javascript. Returns the result of evaluating the
|
||||
# javascript. e.g.
|
||||
#
|
||||
|
@ -117,6 +117,8 @@ module Rhino
|
|||
@native.factory.instruction_limit = limit
|
||||
end
|
||||
|
||||
# Enter this context for operations. Some methods such as eval() will
|
||||
# fail unless this context is open
|
||||
def open
|
||||
begin
|
||||
@native.factory.enterContext(@native)
|
||||
|
@ -126,6 +128,13 @@ module Rhino
|
|||
end if block_given?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def open?
|
||||
@native == J::Context.getCurrentContext() || (raise ContextError, "context must be open")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
class IOReader < Java::JavaIo::Reader #:nodoc:
|
||||
|
|
Loading…
Reference in a new issue