Class: JSONPath::Nodes::CodeNode
- Inherits:
-
PathNode
- Object
- Treetop::Runtime::SyntaxNode
- PathNode
- JSONPath::Nodes::CodeNode
show all
- Defined in:
- lib/jsonpath/nodes.rb
Instance Method Summary
collapse
Methods inherited from PathNode
#recurse, #traverse, #traversing_descendants?
Instance Method Details
#code ⇒ Object
157
158
159
160
161
162
|
# File 'lib/jsonpath/nodes.rb', line 157
def code
@code ||= begin
text = template_code.text_value
text.gsub('@', '(obj)').gsub('\\(obj)', '@')
end
end
|
#execute(obj) ⇒ Object
164
165
166
|
# File 'lib/jsonpath/nodes.rb', line 164
def execute(obj)
eval(code, binding)
end
|