Class: Phut::Syntax::NetnsDirective
- Defined in:
- lib/phut/syntax/netns_directive.rb
Overview
The ‘netns(name) { …attributes… }’ directive.
Instance Method Summary collapse
-
#initialize(alias_name, &block) ⇒ NetnsDirective
constructor
A new instance of NetnsDirective.
- #ip(value) ⇒ Object
- #route(options) ⇒ Object
Methods inherited from Directive
Constructor Details
#initialize(alias_name, &block) ⇒ NetnsDirective
Returns a new instance of NetnsDirective.
9 10 11 12 |
# File 'lib/phut/syntax/netns_directive.rb', line 9 def initialize(alias_name, &block) @attributes = { name: alias_name } instance_eval(&block) end |
Instance Method Details
#ip(value) ⇒ Object
14 15 16 17 |
# File 'lib/phut/syntax/netns_directive.rb', line 14 def ip(value) @attributes[:ip] = value @attributes[:name] ||= value end |
#route(options) ⇒ Object
19 20 21 22 |
# File 'lib/phut/syntax/netns_directive.rb', line 19 def route() @attributes[:net] = .fetch(:net) @attributes[:gateway] = .fetch(:gateway) end |