Sha256: c3c43030a9206f4cb64e02be39668546799bdd0a2d23d2a28fd17b5da55b62c8
Contents?: true
Size: 1.01 KB
Versions: 17
Compression:
Stored size: 1.01 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 b = if ctx ::Proc.new do |*args| ctx.instance_exec(*args, &original_block) end else original_block end if original_block 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
17 entries across 17 versions & 2 rubygems