Class: Keyman::Group

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGroup

Returns a new instance of Group.



6
7
8
# File 'lib/keyman/group.rb', line 6

def initialize
  @users = []
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#usersObject

Returns the value of attribute users.



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

def users
  @users
end

Class Method Details

.add(name, &block) ⇒ Object

Add a new group with the given name



11
12
13
14
15
16
# File 'lib/keyman/group.rb', line 11

def self.add(name, &block)
  g = Group.new
  g.name = name
  g.instance_eval(&block)
  Keyman.groups << g
end

Instance Method Details

#user(*args) ⇒ Object

Add a new user to the group



19
20
21
# File 'lib/keyman/group.rb', line 19

def user(*args)
  @users << User.add(*args)
end