Class: JMESPath::Nodes::Function Private
- Defined in:
- lib/jmespath/nodes/function.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.
Direct Known Subclasses
AbsFunction, AvgFunction, CeilFunction, ContainsFunction, EndsWithFunction, FloorFunction, JoinFunction, KeysFunction, LengthFunction, Map, MaxByFunction, MaxFunction, MergeFunction, MinByFunction, MinFunction, NotNullFunction, ReverseFunction, SortByFunction, SortFunction, StartsWithFunction, SumFunction, ToArrayFunction, ToNumberFunction, ToStringFunction, TypeFunction, ValuesFunction
Defined Under Namespace
Classes: FunctionName
Constant Summary collapse
- FUNCTIONS =
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.
{}
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(children, options = {}) ⇒ Function
constructor
private
A new instance of Function.
- #optimize ⇒ Object private
- #visit(value) ⇒ Object private
Methods inherited from Node
Constructor Details
#initialize(children, options = {}) ⇒ Function
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 Function.
8 9 10 11 12 |
# File 'lib/jmespath/nodes/function.rb', line 8 def initialize(children, = {}) @children = children @options = @disable_visit_errors = @options[:disable_visit_errors] end |
Class Method Details
.create(name, children, options = {}) ⇒ Object
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.
14 15 16 17 18 19 20 |
# File 'lib/jmespath/nodes/function.rb', line 14 def self.create(name, children, = {}) if (type = FUNCTIONS[name]) type.new(children, ) else raise Errors::UnknownFunctionError, "unknown function #{name}()" end end |
Instance Method Details
#optimize ⇒ Object
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.
26 27 28 |
# File 'lib/jmespath/nodes/function.rb', line 26 def optimize self.class.new(@children.map(&:optimize), @options) end |
#visit(value) ⇒ Object
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/nodes/function.rb', line 22 def visit(value) call(@children.map { |child| child.visit(value) }) end |