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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, &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(options, &block)
  @stack = options[:stack].to_a
  instance_eval(&block)
end

Instance Attribute Details

#stackObject (readonly)

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.



18
19
20
# File 'lib/moneta/stack.rb', line 18

def stack
  @stack
end

Instance Method Details

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

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.

Raises:

  • (ArgumentError)


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

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