Class: Omniboard::Group
- Inherits:
-
Object
- Object
- Omniboard::Group
- Includes:
- Comparable
- Defined in:
- lib/omniboard/group.rb
Overview
This class represents a “group” of Projects.
Class Attribute Summary collapse
-
.brightness ⇒ Object
Global values for group colour brightness and saturation.
-
.groups ⇒ Object
All groups in the board.
-
.saturation ⇒ Object
Global values for group colour brightness and saturation.
Instance Attribute Summary collapse
-
#colour ⇒ Object
The colour representation of a group.
-
#identifier ⇒ Object
The identifier for this group.
Class Method Summary collapse
-
.[](identifier) ⇒ Object
Find a group by identifier.
-
.add(g) ⇒ Object
Add a new group to the groups array.
-
.default_colour ⇒ Object
(also: colour)
If we don’t have any groups on our board, this is our default colour for ungrouped projects.
-
.light_colour ⇒ Object
If we don’t have any groups on our board, this is our default light colour for ungrouped projects.
Instance Method Summary collapse
- #<=>(o) ⇒ Object
- #assigned_colour ⇒ Object
- #has_assigned_colour? ⇒ Boolean
-
#initialize(identifier) ⇒ Group
constructor
A new instance of Group.
- #light_colour ⇒ Object
-
#name ⇒ Object
Deprecated methods.
- #name=(n) ⇒ Object
- #reset_colour ⇒ Object
- #to_s ⇒ Object
Constructor Details
Class Attribute Details
.brightness ⇒ Object
Global values for group colour brightness and saturation
27 28 29 |
# File 'lib/omniboard/group.rb', line 27 def brightness @brightness end |
.groups ⇒ Object
All groups in the board
30 31 32 |
# File 'lib/omniboard/group.rb', line 30 def groups @groups end |
.saturation ⇒ Object
Global values for group colour brightness and saturation
27 28 29 |
# File 'lib/omniboard/group.rb', line 27 def saturation @saturation end |
Instance Attribute Details
#colour ⇒ Object
The colour representation of a group
20 21 22 |
# File 'lib/omniboard/group.rb', line 20 def colour @colour end |
#identifier ⇒ Object
The identifier for this group. Can be a string, object, whatever you like.
6 7 8 |
# File 'lib/omniboard/group.rb', line 6 def identifier @identifier end |
Class Method Details
.[](identifier) ⇒ Object
Find a group by identifier
33 34 35 |
# File 'lib/omniboard/group.rb', line 33 def [] identifier @groups.find{ |g| g.identifier == identifier } || new(identifier) end |
.add(g) ⇒ Object
Add a new group to the groups array. Also resets all colour assignments for the group. Note: usually called from initializer.
39 40 41 42 |
# File 'lib/omniboard/group.rb', line 39 def add(g) @groups.each(&:reset_colour) @groups << g end |
Instance Method Details
#<=>(o) ⇒ Object
88 89 90 |
# File 'lib/omniboard/group.rb', line 88 def <=> o self.identifier <=> o.identifier end |
#assigned_colour ⇒ Object
76 77 78 |
# File 'lib/omniboard/group.rb', line 76 def assigned_colour Omniboard::Column::colour_for_group(self.identifier) end |
#has_assigned_colour? ⇒ Boolean
80 81 82 |
# File 'lib/omniboard/group.rb', line 80 def has_assigned_colour? assigned_colour != nil end |
#light_colour ⇒ Object
68 69 70 |
# File 'lib/omniboard/group.rb', line 68 def light_colour colour_obj.light end |
#name ⇒ Object
Deprecated methods
9 10 11 12 |
# File 'lib/omniboard/group.rb', line 9 def name $stderr.puts "Group#name is deprecated. Use Group#identifier instead." @identifier end |
#name=(n) ⇒ Object
14 15 16 17 |
# File 'lib/omniboard/group.rb', line 14 def name= n $stderr.puts "Group#name= is deprecated. Use Group#identifier= instead." @identifier = n end |
#reset_colour ⇒ Object
72 73 74 |
# File 'lib/omniboard/group.rb', line 72 def reset_colour @colour_obj = nil end |
#to_s ⇒ Object
84 85 86 |
# File 'lib/omniboard/group.rb', line 84 def to_s @identifier end |