Class: JMESPath::Runtime Private

Inherits:
Object
  • Object
show all
Defined in:
lib/jmespath/runtime.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

CACHE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{}
MUTEX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Mutex.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Runtime

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Runtime.

Options Hash (options):

  • :parser (Parser)
  • :interpreter (Interpreter)


14
15
16
17
# File 'lib/jmespath/runtime.rb', line 14

def initialize(options = {})
  @parser = options[:parser] || Parser.new
  @interpreter = options[:interpreter] || TreeInterpreter.new
end

Class Method Details

.clear_cacheObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/jmespath/runtime.rb', line 39

def clear_cache
  MUTEX.synchronize { CACHE.clear }
end

Instance Method Details

#search(expression, data) ⇒ Mixed?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/jmespath/runtime.rb', line 22

def search(expression, data)
  @interpreter.visit(parse(expression), data)
end