Class: Rig::Template::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/rig/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DSL

Returns a new instance of DSL.



44
45
46
47
48
# File 'lib/rig/template.rb', line 44

def initialize(name)
  @name      = name.to_sym
  @balancers = []
  @servers   = []
end

Instance Attribute Details

#balancersObject (readonly)

Returns the value of attribute balancers.



42
43
44
# File 'lib/rig/template.rb', line 42

def balancers
  @balancers
end

#serversObject (readonly)

Returns the value of attribute servers.



42
43
44
# File 'lib/rig/template.rb', line 42

def servers
  @servers
end

Instance Method Details

#balancer(name, &block) ⇒ Object



54
55
56
57
58
# File 'lib/rig/template.rb', line 54

def balancer(name, &block)
  balancer = Balancer.new(name)
  balancer.instance_eval &block
  @balancers << balancer
end

#server(name, &block) ⇒ Object



60
61
62
63
64
# File 'lib/rig/template.rb', line 60

def server(name, &block)
  server = Server.new(name)
  server.instance_eval &block
  @servers << server
end

#template(&block) ⇒ Object



50
51
52
# File 'lib/rig/template.rb', line 50

def template(&block)
  instance_eval &block
end