Class: Norikra::Query::ASTEventPropNode
- Defined in:
- lib/norikra/query/ast.rb
Overview
eventProperty
Instance Attribute Summary
Attributes inherited from ASTNode
Instance Method Summary collapse
- #fields(default_target = nil, known_targets_aliases = []) ⇒ Object
-
#nodetype?(*sym) ⇒ Boolean
“‘size.num`” [“eventProperty”, [“eventPropertyAtomic”, [“eventPropertyIdent”, [“keywordAllowedIdent”, “`size.num`”]]]].
Methods inherited from ASTNode
#chain, #child, #find, #has_a?, #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
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 |
# File 'lib/norikra/query/ast.rb', line 1017 def fields(default_target=nil, known_targets_aliases=[]) props = self.listup('eventPropertyAtomic') leading_name = props[0].find('eventPropertyIdent').find('keywordAllowedIdent').child.name if props.size > 1 # alias.fieldname or container_fieldname.key.$1 or fieldname.method(...) non_calls = props.select{|p| p.children.size == 1 }.map{|p| p.find('eventPropertyIdent').find('keywordAllowedIdent').child.name } if known_targets_aliases.include?(leading_name) [ {f: non_calls[1..-1].join("."), t: leading_name} ] else [ {f: non_calls.join("."), t: default_target} ] end else # fieldname (default target) # ["eventProperty", ["eventPropertyAtomic", ["eventPropertyIdent", ["keywordAllowedIdent", "a"]]] [ {f: leading_name, t: default_target } ] end end |
#nodetype?(*sym) ⇒ Boolean
“‘size.num`”
- “eventProperty”, [“eventPropertyAtomic”, [“eventPropertyIdent”, [“keywordAllowedIdent”, “‘size.num`”]]]
1013 1014 1015 |
# File 'lib/norikra/query/ast.rb', line 1013 def nodetype?(*sym) sym.include?(:prop) || sym.include?(:property) end |