Class: RgGen::Core::Builder::Layer::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/core/builder/layer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list_name, feature_name) ⇒ Proxy

Returns a new instance of Proxy.



8
9
10
11
# File 'lib/rggen/core/builder/layer.rb', line 8

def initialize(list_name, feature_name)
  @list_name = list_name
  @feature_name = feature_name
end

Instance Attribute Details

#feature_nameObject (readonly)

Returns the value of attribute feature_name.



14
15
16
# File 'lib/rggen/core/builder/layer.rb', line 14

def feature_name
  @feature_name
end

#list_nameObject (readonly)

Returns the value of attribute list_name.



13
14
15
# File 'lib/rggen/core/builder/layer.rb', line 13

def list_name
  @list_name
end

Instance Method Details

#execute(layer, method_name, &body) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/rggen/core/builder/layer.rb', line 21

def execute(layer, method_name, &body)
  Docile.dsl_eval(layer, &body)
  return unless @executions

  args = [list_name, feature_name, layer.shared_context].compact
  @executions.each do |execution|
    execution[:registry].__send__(method_name, *args, &execution[:body])
  end
end

#register_execution(registry, &body) ⇒ Object



16
17
18
19
# File 'lib/rggen/core/builder/layer.rb', line 16

def register_execution(registry, &body)
  @executions ||= []
  @executions << { registry: registry, body: body }
end