Method: RC::DSL#profile

Defined in:
lib/rc/dsl.rb

#profile(name, state = {}, &block) ⇒ Object

Profile block.

Parameters:

  • name (String, Symbol)

    A profile name.

Raises:

  • (SyntaxError)


36
37
38
39
40
41
42
43
44
45
# File 'lib/rc/dsl.rb', line 36

def profile(name, state={}, &block)
  raise SyntaxError, "nested profile sections" if @_options[:profile]
  original_state = @_options.dup
  @_options.update(state)
  @_options[:profile] = name.to_s

  instance_eval(&block)

  @_options = original_state
end