Class: FrOData::Query::Criteria
- Inherits:
-
Object
- Object
- FrOData::Query::Criteria
- Defined in:
- lib/frodata/query/criteria.rb,
lib/frodata/query/criteria/date_functions.rb,
lib/frodata/query/criteria/lambda_operators.rb,
lib/frodata/query/criteria/string_functions.rb,
lib/frodata/query/criteria/geography_functions.rb,
lib/frodata/query/criteria/comparison_operators.rb
Overview
Represents a discreet criteria within an FrOData::Query. Should not, normally, be instantiated directly.
Defined Under Namespace
Modules: ComparisonOperators, DateFunctions, GeographyFunctions, LambdaOperators, StringFunctions
Instance Attribute Summary collapse
-
#argument ⇒ Object
readonly
An optional argument to the function.
-
#function ⇒ Object
readonly
A function to apply to the property.
-
#operator ⇒ Object
readonly
The operator of the criteria.
-
#property ⇒ Object
readonly
The property name that is the target of the criteria.
-
#value ⇒ Object
readonly
The value of the criteria.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Criteria
constructor
Initializes a new criteria with provided options.
-
#to_s ⇒ Object
Returns criteria as query-ready string.
Methods included from LambdaOperators
Methods included from GeographyFunctions
Methods included from DateFunctions
#date, #day, #fractionalseconds, #hour, #minute, #month, #second, #time, #year
Methods included from StringFunctions
#contains, #endswith, #startswith, #tolower, #toupper
Methods included from ComparisonOperators
Constructor Details
#initialize(options = {}) ⇒ Criteria
Initializes a new criteria with provided options.
25 26 27 28 29 30 31 |
# File 'lib/frodata/query/criteria.rb', line 25 def initialize( = {}) @property = [:property] @operator = [:operator] @function = [:function] @argument = [:argument] @value = [:value] end |
Instance Attribute Details
#argument ⇒ Object (readonly)
An optional argument to the function.
21 22 23 |
# File 'lib/frodata/query/criteria.rb', line 21 def argument @argument end |
#function ⇒ Object (readonly)
A function to apply to the property.
19 20 21 |
# File 'lib/frodata/query/criteria.rb', line 19 def function @function end |
#operator ⇒ Object (readonly)
The operator of the criteria.
15 16 17 |
# File 'lib/frodata/query/criteria.rb', line 15 def operator @operator end |
#property ⇒ Object (readonly)
The property name that is the target of the criteria.
13 14 15 |
# File 'lib/frodata/query/criteria.rb', line 13 def property @property end |
#value ⇒ Object (readonly)
The value of the criteria.
17 18 19 |
# File 'lib/frodata/query/criteria.rb', line 17 def value @value end |
Instance Method Details
#to_s ⇒ Object
Returns criteria as query-ready string.
40 41 42 43 44 45 46 47 48 |
# File 'lib/frodata/query/criteria.rb', line 40 def to_s query = function ? function_expression : property_name if operator && !lambda_operator? "#{query} #{operator} #{url_value(value)}" else query end end |