Sha256: 9aa519fc3776b7f017f7a2264ca70dd3e1825b9e93379c72b51cdd6d8c5ae103

Contents?: true

Size: 553 Bytes

Versions: 5

Compression:

Stored size: 553 Bytes

Contents

require_relative './enum'

module Dentaku
  module AST
    class All < Enum
      def value(context = {})
        collection      = Array(@args[0].value(context))
        item_identifier = @args[1].identifier
        expression      = @args[2]

        collection.all? do |item_value|
          expression.value(
            context.merge(
              FlatHash.from_hash_with_intermediates(item_identifier => item_value)
            )
          )
        end
      end
    end
  end
end

Dentaku::AST::Function.register_class(:all, Dentaku::AST::All)

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
dentaku-3.5.3 lib/dentaku/ast/functions/all.rb
dentaku-3.5.2 lib/dentaku/ast/functions/all.rb
dentaku_zevo-3.5.2 lib/dentaku/ast/functions/all.rb
dentaku-3.5.1 lib/dentaku/ast/functions/all.rb
dentaku-3.5.0 lib/dentaku/ast/functions/all.rb