Class: Muck::ConfigDSL::RootDSL

Inherits:
Object
  • Object
show all
Defined in:
lib/muck/config_dsl/root_dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ RootDSL

Returns a new instance of RootDSL.



7
8
9
# File 'lib/muck/config_dsl/root_dsl.rb', line 7

def initialize(config)
  @config = config
end

Instance Method Details

#defaults(&block) ⇒ Object



18
19
20
21
# File 'lib/muck/config_dsl/root_dsl.rb', line 18

def defaults(&block)
  dsl = ServerDSL.new(@config.defaults)
  dsl.instance_eval(&block)
end

#server(&block) ⇒ Object



11
12
13
14
15
16
# File 'lib/muck/config_dsl/root_dsl.rb', line 11

def server(&block)
  hash = Hash.new
  dsl = ServerDSL.new(hash)
  dsl.instance_eval(&block)
  @config.servers << Server.new(@config, hash)
end