Class: Sanity::Groq::Filter
- Inherits:
-
Object
- Object
- Sanity::Groq::Filter
- Defined in:
- lib/sanity/groq/filter.rb
Constant Summary collapse
- START_PAREN =
"("- END_PAREN =
")"- COMPARISON_OPERATORS =
{ is: "==", not: "!=", gt: ">", gt_eq: ">=", lt: "<", lt_eq: "<=", match: "match" }
- LOGICAL_OPERATORS =
{ and: "&&", or: "||" }
- RESERVED =
COMPARISON_OPERATORS.keys | LOGICAL_OPERATORS.keys
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#filter_value ⇒ Object
readonly
Returns the value of attribute filter_value.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**args) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(**args) ⇒ Filter
Returns a new instance of Filter.
37 38 39 40 |
# File 'lib/sanity/groq/filter.rb', line 37 def initialize(**args) @args = args.except(*Sanity::Groqify::RESERVED - RESERVED) @filter_value = +"" end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
35 36 37 |
# File 'lib/sanity/groq/filter.rb', line 35 def args @args end |
#filter_value ⇒ Object (readonly)
Returns the value of attribute filter_value.
35 36 37 |
# File 'lib/sanity/groq/filter.rb', line 35 def filter_value @filter_value end |
Class Method Details
.call(**args) ⇒ Object
10 11 12 |
# File 'lib/sanity/groq/filter.rb', line 10 def call(**args) new(**args).call end |
Instance Method Details
#call ⇒ Object
42 43 44 45 |
# File 'lib/sanity/groq/filter.rb', line 42 def call iterate filter_value.strip end |