Class: Keyman::Group
- Inherits:
-
Object
- Object
- Keyman::Group
- Defined in:
- lib/keyman/group.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#users ⇒ Object
Returns the value of attribute users.
Class Method Summary collapse
-
.add(name, &block) ⇒ Object
Add a new group with the given name.
Instance Method Summary collapse
-
#initialize ⇒ Group
constructor
A new instance of Group.
-
#user(*args) ⇒ Object
Add a new user to the group.
Constructor Details
#initialize ⇒ Group
Returns a new instance of Group.
6 7 8 |
# File 'lib/keyman/group.rb', line 6 def initialize @users = [] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/keyman/group.rb', line 4 def name @name end |
#users ⇒ Object
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 17 18 19 |
# File 'lib/keyman/group.rb', line 11 def self.add(name, &block) if existing = Keyman.user_or_group_for(name) raise Error, "#{existing.class.to_s.split('::').last} already exists for '#{name}' - cannot define user with this name." end g = Group.new g.name = name g.instance_eval(&block) Keyman.groups << g end |