Class: Keyman::ServerGroup
- Inherits:
-
Object
- Object
- Keyman::ServerGroup
- Defined in:
- lib/keyman/server_group.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#users ⇒ Object
Returns the value of attribute users.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ServerGroup
constructor
A new instance of ServerGroup.
- #server(host, location = nil) ⇒ Object
- #user(name, *access_objects) ⇒ Object
Constructor Details
#initialize ⇒ ServerGroup
Returns a new instance of ServerGroup.
6 7 8 9 |
# File 'lib/keyman/server_group.rb', line 6 def initialize @servers = [] @users = {} end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/keyman/server_group.rb', line 4 def name @name end |
#servers ⇒ Object
Returns the value of attribute servers.
4 5 6 |
# File 'lib/keyman/server_group.rb', line 4 def servers @servers end |
#users ⇒ Object
Returns the value of attribute users.
4 5 6 |
# File 'lib/keyman/server_group.rb', line 4 def users @users end |
Class Method Details
.add(name, &block) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/keyman/server_group.rb', line 11 def self.add(name, &block) s = self.new s.name = name s.instance_eval(&block) Keyman.server_groups << s s end |
Instance Method Details
#server(host, location = nil) ⇒ Object
19 20 21 |
# File 'lib/keyman/server_group.rb', line 19 def server(host, location = nil) @servers << Server.add_by_name(host, :users => @users, :group => self) end |
#user(name, *access_objects) ⇒ Object
23 24 25 26 |
# File 'lib/keyman/server_group.rb', line 23 def user(name, *access_objects) @users[name] = access_objects @servers.each { |s| s.user(name, *access_objects) } end |