Class: Safrano::Filter::UnopTree

Inherits:
Tree show all
Defined in:
lib/odata/filter/base.rb,
lib/odata/filter/tree.rb,
lib/odata/filter/sequel.rb

Overview

unary op eg. NOT

Instance Attribute Summary

Attributes inherited from Tree

#parent

Attributes inherited from RootTree

#children, #state

Attributes inherited from Node

#value

Instance Method Summary collapse

Methods inherited from RootTree

#==, #accept?, #apply_to_dataset, #attach, #check_types, #detach, #first_child_value, #sequel_expr, #update_state

Methods inherited from Node

#==, #success

Constructor Details

#initialize(val) ⇒ UnopTree

Returns a new instance of UnopTree.



206
207
208
# File 'lib/odata/filter/tree.rb', line 206

def initialize(val)
  super(val.downcase.to_sym)
end

Instance Method Details

#edm_typeObject



221
222
223
224
225
226
227
228
# File 'lib/odata/filter/tree.rb', line 221

def edm_type
  case @value
  when :not
    :bool
  else
    :any
  end
end

#leuqes(jh) ⇒ Object



147
148
149
150
151
152
153
154
# File 'lib/odata/filter/sequel.rb', line 147

def leuqes(jh)
  case @value
  when :not
    @children.first.leuqes(jh).map_result! { |l| Sequel.~(l) }
  else
    Safrano::FilterParseError
  end
end

#precedenceObject

reference: OData v4 par 5.1.1.9 Operator Precedence



212
213
214
215
216
217
218
219
# File 'lib/odata/filter/tree.rb', line 212

def precedence
  case @value
  when :not
    7
  else
    999
  end
end