Class: Keyman::ServerGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/keyman/server_group.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServerGroup

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

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/keyman/server_group.rb', line 4

def name
  @name
end

#serversObject

Returns the value of attribute servers.



4
5
6
# File 'lib/keyman/server_group.rb', line 4

def servers
  @servers
end

#usersObject

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