Class: PM::HelpWindow

Inherits:
PmWindow
  • Object
show all
Includes:
Curses
Defined in:
lib/patchmaster/curses/help_window.rb

Constant Summary collapse

CONTENTS =
File.join(File.dirname(__FILE__), 'info_window_contents.txt')

Instance Attribute Summary collapse

Attributes inherited from PmWindow

#title, #title_prefix, #win

Instance Method Summary collapse

Methods inherited from PmWindow

#make_fit, #move_and_resize, #set_max_contents_len, #visible_height

Constructor Details

#initialize(rows, cols, row, col) ⇒ HelpWindow

Returns a new instance of HelpWindow.



12
13
14
15
16
# File 'lib/patchmaster/curses/help_window.rb', line 12

def initialize(rows, cols, row, col)
  super(rows, cols, row, col, nil)
  @text = IO.read(CONTENTS)
  @title = 'PatchMaster Help'
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



10
11
12
# File 'lib/patchmaster/curses/help_window.rb', line 10

def text
  @text
end

Instance Method Details

#drawObject



18
19
20
21
22
23
24
25
26
# File 'lib/patchmaster/curses/help_window.rb', line 18

def draw
  super
  i = 0
  @text.each_line do |line|
    @win.setpos(i+2, 3)
    @win.addstr(make_fit(line.chomp))
    i += 1
  end
end