class Dentaku::AST::Enum

Public Class Methods

max_param_count() click to toggle source
# File lib/dentaku/ast/functions/enum.rb, line 11
def self.max_param_count
  3
end
min_param_count() click to toggle source
# File lib/dentaku/ast/functions/enum.rb, line 7
def self.min_param_count
  3
end
new(*args) click to toggle source
Calls superclass method Dentaku::AST::Function::new
# File lib/dentaku/ast/functions/enum.rb, line 15
def initialize(*args)
  super
  validate_identifier(@args[1])
end

Public Instance Methods

dependencies(context = {}) click to toggle source
# File lib/dentaku/ast/functions/enum.rb, line 20
def dependencies(context = {})
  collection      = @args[0]
  item_identifier = @args[1].identifier
  expression      = @args[2]

  collection_deps = collection.dependencies(context)
  expression_deps = (expression&.dependencies(context) || []).reject do |i|
    i == item_identifier || i.start_with?("#{item_identifier}.")
  end

  collection_deps + expression_deps
end
validate_identifier(arg, message = " click to toggle source
# File lib/dentaku/ast/functions/enum.rb, line 33
def validate_identifier(arg, message = "#{name}() requires second argument to be an identifier")
  raise ParseError.for(:node_invalid), message unless arg.is_a?(Identifier)
end