Sha256: fa8016d371877cc732a9358ce1d35a55e4c59b3848b826e8c5c7732c58374a9e
Contents?: true
Size: 1.01 KB
Versions: 11
Compression:
Stored size: 1.01 KB
Contents
module Middleman module CoreExtensions module Collections class LazyCollectorStep < BasicObject DELEGATE = [:hash, :eql?] 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
11 entries across 11 versions & 1 rubygems