Class: Middleman::CoreExtensions::Collections::LazyCollectorRoot

Inherits:
BasicObject
Defined in:
middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ LazyCollectorRoot

Returns a new instance of LazyCollectorRoot.


9
10
11
12
# File 'middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb', line 9

def initialize(parent)
  @data = nil
  @parent = parent
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object


26
27
28
# File 'middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb', line 26

def method_missing(name, *args, &block)
  LazyCollectorStep.new(name, args, block, self)
end

Instance Method Details

#leavesObject


22
23
24
# File 'middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb', line 22

def leaves
  @parent.leaves
end

#realize!(data) ⇒ Object


14
15
16
# File 'middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb', line 14

def realize!(data)
  @data = data
end

#value(_ctx = nil) ⇒ Object


18
19
20
# File 'middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb', line 18

def value(_ctx = nil)
  @data
end