Class: Norikra::Query::ASTStreamNode

Inherits:
ASTNode
  • Object
show all
Defined in:
lib/norikra/query/ast.rb

Overview

STREAM_EXPR

Instance Attribute Summary

Attributes inherited from ASTNode

#children, #name

Instance Method Summary collapse

Methods inherited from ASTNode

#child, #find, #initialize, #listup, #to_a

Constructor Details

This class inherits a constructor from Norikra::Query::ASTNode

Instance Method Details

#aliasObject



258
259
260
# File 'lib/norikra/query/ast.rb', line 258

def alias
  @children.last.children.size < 1 ? @children.last.name : nil
end

#fields(default_target = nil, known_targets_aliases = []) ⇒ Object



262
263
264
265
# File 'lib/norikra/query/ast.rb', line 262

def fields(default_target=nil, known_targets_aliases=[])
  this_target = self.target
  self.listup('EVENT_PROP_EXPR').map{|p| p.fields(this_target,known_targets_aliases)}.reduce(&:+) || []
end

#nodetype?(*sym) ⇒ Boolean

[“STREAM_EXPR”,

 ["EVENT_FILTER_EXPR", "FraudWarningEvent"],
 ["VIEW_EXPR", "win", "keepall"],
 "fraud"],
["STREAM_EXPR",
 ["EVENT_FILTER_EXPR",
  "PINChangeEvent",
  [">", ["EVENT_PROP_EXPR", ["EVENT_PROP_SIMPLE", "size"]], "10"]],
 ["VIEW_EXPR", "win", "time", ["TIME_PERIOD", ["SECOND_PART", "20"]]]],

Returns:



250
251
252
# File 'lib/norikra/query/ast.rb', line 250

def nodetype?(*sym)
  sym.include?(:stream)
end

#targetObject



254
255
256
# File 'lib/norikra/query/ast.rb', line 254

def target
  self.find('EVENT_FILTER_EXPR').child.name
end