Class: Norikra::Query::ASTEventPropNode
- Defined in:
- lib/norikra/query/ast.rb
Overview
EVENT_PROP_EXPR
Instance Attribute Summary
Attributes inherited from ASTNode
Instance Method Summary collapse
- #fields(default_target = nil, known_targets_aliases = []) ⇒ Object
-
#nodetype?(*sym) ⇒ Boolean
“bbb” => [“EVENT_PROP_EXPR”, [“EVENT_PROP_SIMPLE”, “bbb”]] “fraud.aaa” => [“EVENT_PROP_EXPR”, [“EVENT_PROP_SIMPLE”, “fraud”], [“EVENT_PROP_SIMPLE”, “aaa”]] “size.$0.bytes” => [“EVENT_PROP_EXPR”, [“EVENT_PROP_SIMPLE”, “size”], [“EVENT_PROP_SIMPLE”, “$0”], [“EVENT_PROP_SIMPLE”, “bytes”]].
Methods inherited from ASTNode
#child, #find, #initialize, #listup, #to_a
Constructor Details
This class inherits a constructor from Norikra::Query::ASTNode
Instance Method Details
#fields(default_target = nil, known_targets_aliases = []) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/norikra/query/ast.rb', line 160 def fields(default_target=nil, known_targets_aliases=[]) props = self.listup('EVENT_PROP_SIMPLE') if props.size > 1 # alias.fieldname or container_fieldname.key.$1 if known_targets_aliases.include?(props[0].child.name) [ {:f => props[1..-1].map{|n| n.child.name}.join("."), :t => props[0].child.name} ] else [ {:f => props.map{|n| n.child.name}.join("."), :t => default_target} ] end else # fieldname (default target) [ {:f => props[0].child.name, :t => default_target } ] end end |
#nodetype?(*sym) ⇒ Boolean
“bbb” => [“EVENT_PROP_EXPR”, [“EVENT_PROP_SIMPLE”, “bbb”]] “fraud.aaa” => [“EVENT_PROP_EXPR”, [“EVENT_PROP_SIMPLE”, “fraud”], [“EVENT_PROP_SIMPLE”, “aaa”]] “size.$0.bytes” => [“EVENT_PROP_EXPR”, [“EVENT_PROP_SIMPLE”, “size”], [“EVENT_PROP_SIMPLE”, “$0”], [“EVENT_PROP_SIMPLE”, “bytes”]]
156 157 158 |
# File 'lib/norikra/query/ast.rb', line 156 def nodetype?(*sym) sym.include?(:prop) || sym.include?(:property) end |