Sha256: 94c3e4de9a5d59782261e9de1dbfa64200e6e07b0ca7dbcb2c11e89c889b4117
Contents?: true
Size: 1.05 KB
Versions: 20
Compression:
Stored size: 1.05 KB
Contents
module Middleman module CoreExtensions module Collections class LazyCollectorStep < BasicObject DELEGATE = [:hash, :eql?].freeze def initialize(name, args, block, parent=nil) @name = name @args = args @block = block @parent = parent @result = nil leaves << self end def leaves @parent.leaves end def value(ctx=nil) data = @parent.value(ctx) original_block = @block if original_block b = if ctx ::Proc.new do |*args| ctx.instance_exec(*args, &original_block) end else original_block end end data.send(@name, *@args.deep_dup, &b) end def method_missing(name, *args, &block) return ::Kernel.send(name, *args, &block) if DELEGATE.include? name leaves.delete self LazyCollectorStep.new(name, args, block, self) end end end end end
Version data entries
20 entries across 20 versions & 2 rubygems