Class: Liza::Panel

Inherits:
Unit
  • Object
show all
Defined in:
lib/liza/subsystemic_units/panel.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Unit

_erbs_for, #add, add, #cl, cl, class_methods_defined, const_added, const_missing, constants_defined, define_error, descendants_select, erbs_available, erbs_defined, erbs_for, errors, #fetch, fetch, get, #get, instance_methods_defined, #log, log, log?, #log?, log_array, #log_array, #log_hash, log_hash, #log_level, log_level, log_level?, #log_level?, log_levels, #log_levels, #log_render_convert, #log_render_format, #log_render_in, #log_render_out, method_added, methods_defined, namespace, part, raise_error, #raise_error, #reload!, reload!, #render, #render!, #render_stack, renderable_formats_for, renderable_names, section, sections, #set, set, #settings, settings, singleton_method_added, sleep, #sleep, stick, #stick, #sticks, sticks, subclasses_select, subunits, #system, system, system?, test_class, time_diff, #time_diff

Constructor Details

#initialize(key) ⇒ Panel

Returns a new instance of Panel.



63
64
65
66
67
# File 'lib/liza/subsystemic_units/panel.rb', line 63

def initialize key
  @key = key
  @blocks = []
  @unstarted = true
end

Instance Attribute Details

#key ⇒ Object (readonly)

Returns the value of attribute key.



61
62
63
# File 'lib/liza/subsystemic_units/panel.rb', line 61

def key
  @key
end

Class Method Details

.box ⇒ Object



17
18
19
# File 'lib/liza/subsystemic_units/panel.rb', line 17

def self.box
  system.box
end

.color ⇒ Object

color



55
56
57
# File 'lib/liza/subsystemic_units/panel.rb', line 55

def self.color
  system.color
end

.controller ⇒ Object



25
26
27
# File 'lib/liza/subsystemic_units/panel.rb', line 25

def self.controller
  @controller ||= system.const token
end

.division ⇒ Object



33
34
35
# File 'lib/liza/subsystemic_units/panel.rb', line 33

def self.division
  controller.division
end

.instance ⇒ Object



10
11
12
13
14
15
# File 'lib/liza/subsystemic_units/panel.rb', line 10

def self.instance
  x = self
  x = x.ancestors.take_while { _1.last_namespace == x.last_namespace }.last
  x = x.last_namespace.to_s.sub('Panel', '').snakecase.to_sym
  box.configuration[x]
end

.subsystem ⇒ Object



45
46
47
# File 'lib/liza/subsystemic_units/panel.rb', line 45

def self.subsystem
  controller
end

.token ⇒ Object



41
42
43
# File 'lib/liza/subsystemic_units/panel.rb', line 41

def self.token
  @token ||= last_namespace.gsub(/Panel$/, '').snakecase.to_sym
end

Instance Method Details

#box ⇒ Object



21
22
23
# File 'lib/liza/subsystemic_units/panel.rb', line 21

def box
  system.box
end

#controller ⇒ Object



29
30
31
# File 'lib/liza/subsystemic_units/panel.rb', line 29

def controller
  self.class.controller
end

#division ⇒ Object



37
38
39
# File 'lib/liza/subsystemic_units/panel.rb', line 37

def division
  controller.division
end

#push(block) ⇒ Object



71
72
73
74
# File 'lib/liza/subsystemic_units/panel.rb', line 71

def push block
  @unstarted = true
  @blocks.push block
end

#started ⇒ Object



76
77
78
79
80
81
82
83
84
# File 'lib/liza/subsystemic_units/panel.rb', line 76

def started
  return self unless defined? @unstarted
  remove_instance_variable :@unstarted

  @blocks.each { |bl| instance_eval(&bl) }
  @blocks.clear

  self
end

#subsystem ⇒ Object



49
50
51
# File 'lib/liza/subsystemic_units/panel.rb', line 49

def subsystem
  controller
end