Class: Moxml::XPath::Context
- Inherits:
-
Object
- Object
- Moxml::XPath::Context
- Defined in:
- lib/moxml/xpath/context.rb
Overview
Class used as the context for compiled XPath Procs.
The binding of this class is used for the binding of Procs compiled by Compiler. Not using a specific binding would result in the procs using the binding of Moxml::XPath::Compiler#compile, which could lead to race conditions.
Instance Method Summary collapse
-
#evaluate(string) ⇒ Proc
Evaluates a Ruby code string in this context’s binding.
-
#initialize ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize ⇒ Context
Returns a new instance of Context.
13 14 15 |
# File 'lib/moxml/xpath/context.rb', line 13 def initialize @binding = binding end |
Instance Method Details
#evaluate(string) ⇒ Proc
Evaluates a Ruby code string in this context’s binding.
21 22 23 |
# File 'lib/moxml/xpath/context.rb', line 21 def evaluate(string) @binding.eval(string) end |