class Object

Constants

Host

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

Public Instance Methods

address(name, address) click to toggle source
# File lib/asbestos/dsl.rb, line 34
def address(name, address)
  Asbestos::Address[name] = [*address]
end
host(name, &block) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/asbestos/dsl.rb, line 26
def rule_set(name, &template)
  Asbestos::RuleSet[name.to_sym] = template
end
service(name, &template) click to toggle source
# File lib/asbestos/dsl.rb, line 30
def service(name, &template)
  Asbestos::Service[name.to_sym] = template
end