Class: Phut::Syntax

Inherits:
Object
  • Object
show all
Defined in:
lib/phut/syntax.rb

Overview

DSL syntax definitions.

Defined Under Namespace

Classes: NetnsDirective, VhostDirective, VswitchDirective

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Syntax

Returns a new instance of Syntax.



105
106
107
# File 'lib/phut/syntax.rb', line 105

def initialize(config)
  @config = config
end

Instance Method Details



124
125
126
# File 'lib/phut/syntax.rb', line 124

def link(name_a, name_b)
  @config.add_link name_a, name_b
end

#netns(name, &block) ⇒ Object



119
120
121
122
# File 'lib/phut/syntax.rb', line 119

def netns(name, &block)
  attrs = NetnsDirective.new(name, &block)
  @config.add_netns attrs[:name], attrs
end

#vhost(alias_name = nil, &block) ⇒ Object



114
115
116
117
# File 'lib/phut/syntax.rb', line 114

def vhost(alias_name = nil, &block)
  attrs = VhostDirective.new(alias_name, &block)
  @config.add_vhost attrs[:name], attrs
end

#vswitch(alias_name = nil, &block) ⇒ Object



109
110
111
112
# File 'lib/phut/syntax.rb', line 109

def vswitch(alias_name = nil, &block)
  attrs = VswitchDirective.new(alias_name, &block)
  @config.add_vswitch attrs[:name], attrs
end