Class: Moneta::Stack::DSL Private

Inherits:
Object
  • Object
show all
Defined in:
lib/moneta/stack.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(stack, &block) ⇒ DSL

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DSL.



20
21
22
23
# File 'lib/moneta/stack.rb', line 20

def initialize(stack, &block)
  @stack = stack
  instance_eval(&block)
end

Instance Method Details

#add(store = nil, &block) ⇒ Object

Raises:

  • (ArgumentError)


26
27
28
29
30
# File 'lib/moneta/stack.rb', line 26

def add(store = nil, &block)
  raise ArgumentError, 'Only argument or block allowed' if store && block
  @stack << (store || Moneta.build(&block))
  nil
end