Module: CloudSesame::Query::DSL::Literal
- Included in:
- FilterQuery
- Defined in:
- lib/cloud_sesame/query/dsl/literal.rb
Instance Method Summary collapse
-
#literal(value) ⇒ Object
(also: #l, #field)
LITERAL: creates a single LITERAL node =======================================.
-
#near(value) ⇒ Object
(also: #n, #sloppy)
NEAR: creates a single NEAR node =======================================.
-
#phrase(value) ⇒ Object
PHRASE: creates a single PHRASE node =======================================.
-
#prefix(value) ⇒ Object
(also: #p, #start_with, #begin_with)
PREFIX: creates a single PREFIX node =======================================.
-
#term(value) ⇒ Object
TERM: creates a single TERM node =======================================.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(field, *values, &block) ⇒ Object (private)
60 61 62 63 64 65 66 67 |
# File 'lib/cloud_sesame/query/dsl/literal.rb', line 60 def method_missing(field, *values, &block) if fields && ( = fields[field]) method_scope.children.for_field field method_scope.children.insert_and_return_children values else super end end |
Instance Method Details
#literal(value) ⇒ Object Also known as: l, field
LITERAL: creates a single LITERAL node
8 9 10 11 |
# File 'lib/cloud_sesame/query/dsl/literal.rb', line 8 def literal(value) field = method_scope.children.field AST::Literal.new field, value, fields[field] end |
#near(value) ⇒ Object Also known as: n, sloppy
NEAR: creates a single NEAR node
18 19 20 |
# File 'lib/cloud_sesame/query/dsl/literal.rb', line 18 def near(value) create_literal_with_operator AST::Near, value end |
#phrase(value) ⇒ Object
PHRASE: creates a single PHRASE node
37 38 39 |
# File 'lib/cloud_sesame/query/dsl/literal.rb', line 37 def phrase(value) create_literal_with_operator AST::Phrase, value end |
#prefix(value) ⇒ Object Also known as: p, start_with, begin_with
PREFIX: creates a single PREFIX node
27 28 29 |
# File 'lib/cloud_sesame/query/dsl/literal.rb', line 27 def prefix(value) create_literal_with_operator AST::Prefix, value end |
#term(value) ⇒ Object
TERM: creates a single TERM node
43 44 45 |
# File 'lib/cloud_sesame/query/dsl/literal.rb', line 43 def term(value) create_literal_with_operator AST::Term, value end |