Class: Eclair::Group

Inherits:
Cell
  • Object
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

Methods included from CommonHelper

#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

#colorObject



24
25
26
# File 'lib/eclair/group.rb', line 24

def color
  super(*config.group_color)
end

#formatObject



28
29
30
# File 'lib/eclair/group.rb', line 28

def format
  " #{@group_name} (#{count(&:connectable?)}) #{select_indicator}"
end

#headerObject



32
33
34
35
36
# File 'lib/eclair/group.rb', line 32

def header
  ["Group #{@group_name}",
  "#{count} Instances Total",
  "#{count(&:running?)} Instances Running"]
end

#infoObject



50
51
52
# File 'lib/eclair/group.rb', line 50

def info
  @items.map(&:info)
end

#itemsObject



38
39
40
# File 'lib/eclair/group.rb', line 38

def items
  @items
end

#nameObject



42
43
44
# File 'lib/eclair/group.rb', line 42

def name
  @group_name
end

#objectObject



46
47
48
# File 'lib/eclair/group.rb', line 46

def object
  @group_name
end

#xObject



16
17
18
# File 'lib/eclair/group.rb', line 16

def x
  column.x
end

#yObject



20
21
22
# File 'lib/eclair/group.rb', line 20

def y
  column.index(self)
end