class Dentaku::AST::Pluck

def value(context = {})

def value(context = {})
  collection = Array(@args[0].value(context))
  unless collection.all? { |elem| elem.is_a?(Hash) }
    raise ArgumentError.for(:incompatible_type, value: collection),
          'PLUCK() requires first argument to be an array of hashes'
  end
  pluck_path = @args[1].identifier
  default    = @args[2]
  collection.map { |h|
    h.transform_keys(&:to_s).fetch(pluck_path, default&.value(context))
  }
end