Class: Phut::Syntax::NetnsDirective
- Inherits:
-
Object
- Object
- Phut::Syntax::NetnsDirective
- Defined in:
- lib/phut/syntax.rb
Overview
The ‘netns(name) { …attributes… }’ directive.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(alias_name, &block) ⇒ NetnsDirective
constructor
A new instance of NetnsDirective.
- #ip(value) ⇒ Object
- #netmask(value) ⇒ Object
- #route(options) ⇒ Object
Constructor Details
#initialize(alias_name, &block) ⇒ NetnsDirective
Returns a new instance of NetnsDirective.
81 82 83 84 |
# File 'lib/phut/syntax.rb', line 81 def initialize(alias_name, &block) @attributes = { name: alias_name } instance_eval(&block) end |
Instance Method Details
#[](key) ⇒ Object
100 101 102 |
# File 'lib/phut/syntax.rb', line 100 def [](key) @attributes[key] end |
#ip(value) ⇒ Object
86 87 88 89 |
# File 'lib/phut/syntax.rb', line 86 def ip(value) @attributes[:ip] = value @attributes[:name] ||= value end |
#netmask(value) ⇒ Object
91 92 93 |
# File 'lib/phut/syntax.rb', line 91 def netmask(value) @attributes[:netmask] = value end |
#route(options) ⇒ Object
95 96 97 98 |
# File 'lib/phut/syntax.rb', line 95 def route() @attributes[:net] = .fetch(:net) @attributes[:gateway] = .fetch(:gateway) end |