Module: Kumi::Core::Analyzer::FnAliases
- Defined in:
- lib/kumi/core/analyzer/fn_aliases.rb
Constant Summary collapse
- MAP =
Canonical names use simple domains:
-
core.* : elementwise / structural ops
-
agg.* : reductions (sum, etc.)
NOTE: keep this lexical-only. Overload resolution (e.g. length on string vs array)
should happen in a later resolver pass. -
{ :+ => :"core.add", :- => :"core.sub", :* => :"core.mul", :/ => :"core.div", :% => :"core.mod", :** => :"core.pow", :"==" => :"core.eq", :"!=" => :"core.neq", :">" => :"core.gt", :">=" => :"core.gte", :"<" => :"core.lt", :"<=" => :"core.lte", :"&" => :"core.and", :"!" => :"core.not" }.freeze
Class Method Summary collapse
-
.canonical(fn) ⇒ Object
Public: normalize any fn identifier (String/Symbol) to canonical Symbol.
Class Method Details
.canonical(fn) ⇒ Object
Public: normalize any fn identifier (String/Symbol) to canonical Symbol. Unknown names are returned unchanged (as Symbol).
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kumi/core/analyzer/fn_aliases.rb', line 33 def self.canonical(fn) key = case fn when Symbol then fn when String then fn.strip.downcase.to_sym else fn.to_s.strip.downcase.to_sym end MAP.fetch(key, key) end |