Class: OdataDuty::SearchTerm
- Inherits:
-
Object
- Object
- OdataDuty::SearchTerm
- Defined in:
- lib/odata_duty/parslet_search_expression.rb
Instance Attribute Summary collapse
-
#negated ⇒ Object
readonly
Returns the value of attribute negated.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, negated:) ⇒ SearchTerm
constructor
A new instance of SearchTerm.
- #not? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(value, negated:) ⇒ SearchTerm
Returns a new instance of SearchTerm.
59 60 61 62 |
# File 'lib/odata_duty/parslet_search_expression.rb', line 59 def initialize(value, negated:) @value = value @negated = negated end |
Instance Attribute Details
#negated ⇒ Object (readonly)
Returns the value of attribute negated.
57 58 59 |
# File 'lib/odata_duty/parslet_search_expression.rb', line 57 def negated @negated end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
57 58 59 |
# File 'lib/odata_duty/parslet_search_expression.rb', line 57 def value @value end |
Instance Method Details
#not? ⇒ Boolean
64 65 66 |
# File 'lib/odata_duty/parslet_search_expression.rb', line 64 def not? @negated end |
#to_s ⇒ Object
68 69 70 71 72 |
# File 'lib/odata_duty/parslet_search_expression.rb', line 68 def to_s prefix = ('NOT ' if @negated) quoted = @value.include?(' ') ? "\"#{@value}\"" : @value "#{prefix}#{quoted}" end |