Class: Opsicle::Monitor::Panel
- Inherits:
-
Object
- Object
- Opsicle::Monitor::Panel
- Includes:
- Translatable
- Defined in:
- lib/opsicle/monitor/panel.rb
Direct Known Subclasses
Opsicle::Monitor::Panels::Deployments, Opsicle::Monitor::Panels::Header, Opsicle::Monitor::Panels::Help, Opsicle::Monitor::Panels::Instances
Instance Attribute Summary collapse
-
#divider_length ⇒ Object
readonly
Returns the value of attribute divider_length.
-
#dividers ⇒ Object
readonly
Returns the value of attribute dividers.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(height, width, top, left, structure = [], opts = {}) ⇒ Panel
constructor
A new instance of Panel.
- #refresh ⇒ Object
- #refresh_spies ⇒ Object
Methods included from Translatable
Constructor Details
#initialize(height, width, top, left, structure = [], opts = {}) ⇒ Panel
Returns a new instance of Panel.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/opsicle/monitor/panel.rb', line 19 def initialize(height, width, top, left, structure = [], opts = {}) @height = height @width = width @top = top @left = left @dividers = { :left => opts[:divider_l].to_s, :right => opts[:divider_r].to_s, } @divider_length = @dividers.values.map(&:length).inject(:+) @window = Curses::Window.new(@height, @width, @top, @left) @subpanels = build_subpanels(structure) @spies = {} # data sources for #structure end |
Instance Attribute Details
#divider_length ⇒ Object (readonly)
Returns the value of attribute divider_length.
17 18 19 |
# File 'lib/opsicle/monitor/panel.rb', line 17 def divider_length @divider_length end |
#dividers ⇒ Object (readonly)
Returns the value of attribute dividers.
16 17 18 |
# File 'lib/opsicle/monitor/panel.rb', line 16 def dividers @dividers end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
12 13 14 |
# File 'lib/opsicle/monitor/panel.rb', line 12 def height @height end |
#left ⇒ Object (readonly)
Returns the value of attribute left.
15 16 17 |
# File 'lib/opsicle/monitor/panel.rb', line 15 def left @left end |
#top ⇒ Object (readonly)
Returns the value of attribute top.
14 15 16 |
# File 'lib/opsicle/monitor/panel.rb', line 14 def top @top end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
13 14 15 |
# File 'lib/opsicle/monitor/panel.rb', line 13 def width @width end |
Instance Method Details
#close ⇒ Object
39 40 41 |
# File 'lib/opsicle/monitor/panel.rb', line 39 def close @window.close end |
#refresh ⇒ Object
43 44 45 46 47 |
# File 'lib/opsicle/monitor/panel.rb', line 43 def refresh @subpanels.each(&:refresh) # build changes @window.refresh # push changes to window end |
#refresh_spies ⇒ Object
49 50 51 |
# File 'lib/opsicle/monitor/panel.rb', line 49 def refresh_spies @spies.each { |_, s| s.refresh } # refresh data sources end |