Class: Rig::Template::DSL
- Inherits:
-
Object
- Object
- Rig::Template::DSL
- Defined in:
- lib/rig/template.rb
Instance Attribute Summary collapse
-
#balancers ⇒ Object
readonly
Returns the value of attribute balancers.
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
Instance Method Summary collapse
- #balancer(name, &block) ⇒ Object
-
#initialize(name) ⇒ DSL
constructor
A new instance of DSL.
- #server(name, &block) ⇒ Object
- #template(&block) ⇒ Object
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
#balancers ⇒ Object (readonly)
Returns the value of attribute balancers.
42 43 44 |
# File 'lib/rig/template.rb', line 42 def balancers @balancers end |
#servers ⇒ Object (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 |