Class: Rubeus::Awt::Nestable::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/rubeus/awt/nestable.rb

Class Method Summary collapse

Class Method Details

.add_component_if_container_exist(component, &block) ⇒ Object



24
25
26
27
# File 'lib/rubeus/awt/nestable.rb', line 24

def self.add_component_if_container_exist(component, &block)
  @container ||= nil
  @container.send(@action, component) if @container
end

.add_new_component_to(container, action = :add, block_argument = nil, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rubeus/awt/nestable.rb', line 29

def self.add_new_component_to(container, action = :add, block_argument = nil, &block)
  former_container = @container
  former_action = @action
  @container = container
  @action = action
  begin
    yield(block_argument || container)
  ensure
    @container = former_container
    @action = former_action
  end
end

.containerObject



42
43
44
# File 'lib/rubeus/awt/nestable.rb', line 42

def self.container
  @container
end

.container_class_namesObject



12
13
14
# File 'lib/rubeus/awt/nestable.rb', line 12

def self.container_class_names
  @container_class_names ||= []
end

.container_class_names=(*class_names) ⇒ Object



16
17
18
# File 'lib/rubeus/awt/nestable.rb', line 16

def self.container_class_names=(*class_names)
  @container_class_names = class_names
end

.register_as_container(*class_names) ⇒ Object



20
21
22
# File 'lib/rubeus/awt/nestable.rb', line 20

def self.register_as_container(*class_names)
  self.container_class_names.concat(class_names)
end