Class: Eclair::Group
- Inherits:
-
Cell
- Object
- Cell
- Eclair::Group
show all
- Defined in:
- lib/eclair/group.rb
Instance Attribute Summary
Attributes inherited from Cell
#column, #selected
Instance Method Summary
collapse
Methods inherited from Cell
#check_scroll, #current, #decurrent, #deselect, #method_missing, #redraw, #render, #select, #select_indicator, #toggle_select
#config, included
Constructor Details
#initialize(group_name, column = nil) ⇒ Group
Returns a new instance of Group.
5
6
7
8
9
10
|
# File 'lib/eclair/group.rb', line 5
def initialize group_name, column = nil
super
@group_name = group_name
@items = []
@column = column
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Eclair::Cell
Instance Method Details
#<<(instance) ⇒ Object
12
13
14
|
# File 'lib/eclair/group.rb', line 12
def << instance
@items << instance
end
|
#color ⇒ Object
24
25
26
|
# File 'lib/eclair/group.rb', line 24
def color
super(*config.group_color)
end
|
28
29
30
|
# File 'lib/eclair/group.rb', line 28
def format
" #{@group_name} (#{count(&:connectable?)}) #{select_indicator}"
end
|
32
33
34
35
36
|
# File 'lib/eclair/group.rb', line 32
def
["Group #{@group_name}",
"#{count} Instances Total",
"#{count(&:running?)} Instances Running"]
end
|
#info ⇒ Object
50
51
52
|
# File 'lib/eclair/group.rb', line 50
def info
@items.map(&:info)
end
|
#items ⇒ Object
38
39
40
|
# File 'lib/eclair/group.rb', line 38
def items
@items
end
|
#name ⇒ Object
42
43
44
|
# File 'lib/eclair/group.rb', line 42
def name
@group_name
end
|
#object ⇒ Object
46
47
48
|
# File 'lib/eclair/group.rb', line 46
def object
@group_name
end
|
#x ⇒ Object
16
17
18
|
# File 'lib/eclair/group.rb', line 16
def x
column.x
end
|
#y ⇒ Object
20
21
22
|
# File 'lib/eclair/group.rb', line 20
def y
column.index(self)
end
|