Top Level Namespace

Defined Under Namespace

Modules: Asbestos

Constant Summary collapse

Host =

For referencing lazy hosts in the dsl without prepending “Asbestos::”

Asbestos::Host

Instance Method Summary collapse

Instance Method Details

#address(name, address) ⇒ Object



34
35
36
# File 'lib/asbestos/dsl.rb', line 34

def address(name, address)
  Asbestos::Address[name] = [*address]
end

#host(name, &block) ⇒ Object



20
21
22
23
24
# File 'lib/asbestos/dsl.rb', line 20

def host(name, &block)
  Asbestos::Host.new(name.to_sym).tap do |h|
    h.instance_eval &block if block_given?
  end
end

#host_template(name, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/asbestos/dsl.rb', line 2

def host_template(name, &block)
  name = name.to_sym
  Asbestos::HostTemplate.new(name, block).tap do |host_template|

    #
    # Calling define_method wont let you define block parameters,
    # but doing it this way will
    #
    Object.send(:define_method, name) do |host_name, &block|
      host(host_name, &host_template.template).tap do |h|
        h.instance_eval &block if block
        h.template = name
      end
    end

  end
end

#rule_set(name, &template) ⇒ Object



26
27
28
# File 'lib/asbestos/dsl.rb', line 26

def rule_set(name, &template)
  Asbestos::RuleSet[name.to_sym] = template
end

#service(name, &template) ⇒ Object



30
31
32
# File 'lib/asbestos/dsl.rb', line 30

def service(name, &template)
  Asbestos::Service[name.to_sym] = template
end