Sha256: 97d3a300fd6f82d76d8afea63ccf9c5bd491acd37d38440d3852565a2113eb2e
Contents?: true
Size: 752 Bytes
Versions: 1
Compression:
Stored size: 752 Bytes
Contents
require_relative '../function' require_relative '../../exceptions' module Dentaku module AST class All < Function def self.min_param_count 3 end def self.max_param_count 3 end def deferred_args [1, 2] end def value(context = {}) collection = @args[0].value(context) item_identifier = @args[1].identifier expression = @args[2] Array(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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dentaku-3.4.2 | lib/dentaku/ast/functions/all.rb |