Class: Vedeu::DSL::Group
- Inherits:
-
Object
- Object
- Vedeu::DSL::Group
- Includes:
- Vedeu::DSL
- Defined in:
- lib/vedeu/dsl/group.rb
Overview
DSL for adding interfaces to a group.
Instance Attribute Summary collapse
- #client ⇒ Object readonly private
- #model ⇒ Group readonly private
Class Method Summary collapse
-
.group(name, &block) ⇒ Vedeu::Group
Specify a new group of interfaces with a simple DSL.
Instance Method Summary collapse
-
#add(interface_name) ⇒ void
Add the named interface to this group.
-
#initialize(model, client = nil) ⇒ Vedeu::DSL::Group
constructor
Returns an instance of DSL::Group.
Methods included from Vedeu::DSL
Constructor Details
#initialize(model, client = nil) ⇒ Vedeu::DSL::Group
Returns an instance of DSL::Group.
48 49 50 51 |
# File 'lib/vedeu/dsl/group.rb', line 48 def initialize(model, client = nil) @model = model @client = client end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vedeu::DSL
Instance Attribute Details
#client ⇒ Object (readonly, private)
64 65 66 |
# File 'lib/vedeu/dsl/group.rb', line 64 def client @client end |
#model ⇒ Group (readonly, private)
67 68 69 |
# File 'lib/vedeu/dsl/group.rb', line 67 def model @model end |
Class Method Details
.group(name, &block) ⇒ Vedeu::Group
Note:
Creating a group with the same name as an existing group overwrites the existing group.
Specify a new group of interfaces with a simple DSL.
The example below resembles ‘vim’ (the popular terminal-based text editor):
37 38 39 40 41 |
# File 'lib/vedeu/dsl/group.rb', line 37 def self.group(name, &block) fail InvalidSyntax, 'block not given' unless block_given? Vedeu::Group.build({ name: name }, &block).store end |
Instance Method Details
#add(interface_name) ⇒ void
This method returns an undefined value.
Add the named interface to this group.
57 58 59 |
# File 'lib/vedeu/dsl/group.rb', line 57 def add(interface_name) model.add(interface_name) end |