Class: Safrano::Filter::IdentityFuncTree

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

Overview

Indentity Func to use as “parent” func of parenthesis expressions –> allow to handle generically parenthesis always as argument of some function

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 FuncTree

#accept?, #args, #check_types, #max_arity

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

#initializeIdentityFuncTree

Returns a new instance of IdentityFuncTree.



169
170
171
# File 'lib/odata/filter/tree.rb', line 169

def initialize
  super(:__indentity)
end

Instance Method Details

#==(other) ⇒ Object



199
200
201
# File 'lib/odata/filter/tree.rb', line 199

def ==(other)
  @children == other.children
end

#arity_full?(cursize) ⇒ Boolean

we can have parenthesis with one expression inside everywhere only in FuncTree this is redefined for the function’s arity Note: if you change this method, please also update arity_full_monkey?

see below

Returns:

  • (Boolean)


177
178
179
# File 'lib/odata/filter/tree.rb', line 177

def arity_full?(cursize)
  cursize >= 1
end

#arity_full_monkey?(cursize) ⇒ Boolean

this is for testing only. see 99_threadsafe_tc.rb there we will monkey patch arity_full? by adding some sleeping to easily slow down a given test-thread (while the other one runs normaly)

The rule is to keep this method here exactly same as the original

"productive" one

With this trick we can test threadsafeness without touching “productive” code

Returns:

  • (Boolean)


191
192
193
# File 'lib/odata/filter/tree.rb', line 191

def arity_full_monkey?(cursize)
  cursize >= 1
end

#edm_typeObject



195
196
197
# File 'lib/odata/filter/tree.rb', line 195

def edm_type
  @children.first.edm_type
end

#leuqes(jh) ⇒ Object



140
141
142
# File 'lib/odata/filter/sequel.rb', line 140

def leuqes(jh)
  args.first.leuqes(jh)
end