Class: JMESPath::Nodes::EndsWithFunction Private
- Includes:
- TypeChecker
- 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.
Constant Summary
Constants included from TypeChecker
TypeChecker::ARRAY_TYPE, TypeChecker::BOOLEAN_TYPE, TypeChecker::EXPRESSION_TYPE, TypeChecker::NULL_TYPE, TypeChecker::NUMBER_TYPE, TypeChecker::OBJECT_TYPE, TypeChecker::STRING_TYPE, TypeChecker::TYPE_NAMES
Constants inherited from Function
Instance Method Summary collapse
- #call(args) ⇒ Object private
Methods included from TypeChecker
Methods inherited from Function
create, #initialize, #optimize, #visit
Methods inherited from Node
#chains_with?, #optimize, #visit
Constructor Details
This class inherits a constructor from JMESPath::Nodes::Function
Instance Method Details
#call(args) ⇒ 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.
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File 'lib/jmespath/nodes/function.rb', line 563 def call(args) if args.count == 2 search, suffix = args search_type = get_type(search) suffix_type = get_type(suffix) if search_type != STRING_TYPE msg = 'function ends_with() expects first argument to be a string' return maybe_raise Errors::InvalidTypeError, msg end if suffix_type != STRING_TYPE msg = 'function ends_with() expects second argument to be a string' return maybe_raise Errors::InvalidTypeError, msg end search.end_with?(suffix) else msg = 'function ends_with() expects two arguments' return maybe_raise Errors::InvalidArityError, msg end end |