Class: OdataDuty::SearchTerm

Inherits:
Object
  • Object
show all
Defined in:
lib/odata_duty/parslet_search_expression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#negatedObject (readonly)

Returns the value of attribute negated.



57
58
59
# File 'lib/odata_duty/parslet_search_expression.rb', line 57

def negated
  @negated
end

#valueObject (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

Returns:

  • (Boolean)


64
65
66
# File 'lib/odata_duty/parslet_search_expression.rb', line 64

def not?
  @negated
end

#to_sObject



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