class Safrano::Filter::RootTree

RootTrees have childrens but no parent

RootTrees have childrens but no parent

RootTrees have childrens but no parent

Attributes

children[R]
state[RW]

Public Class Methods

new(val: :root, &block) click to toggle source
Calls superclass method Safrano::Filter::Node::new
# File lib/odata/filter/tree.rb, line 43
def initialize(val: :root, &block)
  @children = []
  super(val, &block)
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method Safrano::Filter::Node#==
# File lib/odata/filter/tree.rb, line 59
def ==(other)
  super(other) && (@children == other.children)
end
accept?(tok, typ) click to toggle source

nil is considered as accepted, otherwise non-nil=the error

# File lib/odata/filter/tree.rb, line 66
def accept?(tok, typ)
  case typ
  when :Literal, :NullLiteral, :Qualit, :QString, :FuncTree, :ArgTree,
       :UnopTree, :FPNumber
    nil
  when :Delimiter
    if tok == '('
      nil
    else
      Parser::ErrorInvalidToken.new(tok, typ, self)
    end
  else
    Parser::ErrorInvalidToken.new(tok, typ, self)
  end
end
apply_to_dataset(dtcx, jh) click to toggle source
# File lib/odata/filter/sequel.rb, line 18
def apply_to_dataset(dtcx, jh)
  @children.first.leuqes(jh).if_valid do |filtexpr|
    jh.dataset(dtcx).where(filtexpr).select_all(jh.start_model.table_name)
  end
end
attach(child) click to toggle source
# File lib/odata/filter/tree.rb, line 48
def attach(child)
  child.parent = self
  @children << child
  Contract::OK
end
check_types() click to toggle source
# File lib/odata/filter/tree.rb, line 82
def check_types
  err = nil
  @children.find { |c| (err = c.check_types) }
  err
end
detach(child) click to toggle source
# File lib/odata/filter/tree.rb, line 54
def detach(child)
  child.parent = nil
  @children.delete(child)
end
sequel_expr(jh) click to toggle source
# File lib/odata/filter/sequel.rb, line 24
def sequel_expr(jh)
  @children.first.leuqes(jh)
end
update_state(tok, typ) click to toggle source
# File lib/odata/filter/tree.rb, line 63
def update_state(tok, typ) end