Module: Nfoiled
- Defined in:
- lib/nfoiled.rb,
lib/nfoiled/window.rb
Overview
See ‘README.markdown`.
Defined Under Namespace
Classes: Window
Constant Summary collapse
- Version =
0
Class Attribute Summary collapse
-
.initialized ⇒ Object
(also: initialized?)
Returns the value of attribute initialized.
Class Method Summary collapse
-
.finalize ⇒ Object
This module method ensures that Nfoiled is finalize.
-
.finalize! ⇒ Object
This method is responsible for tearing down any environment set up by the ‘Ncurses::initialize!` method.
-
.initialize ⇒ Object
This module method ensures that Nfoiled is initialized.
-
.initialize! ⇒ Object
This module method is responsible for setting up the entirety of Nfoiled’s overall environment.
Class Attribute Details
.initialized ⇒ Object Also known as: initialized?
Returns the value of attribute initialized.
12 13 14 |
# File 'lib/nfoiled.rb', line 12 def initialized @initialized end |
Class Method Details
.finalize ⇒ Object
This module method ensures that Nfoiled is finalize. It simply calls ‘Nfoiled::finalize!` if Nfoiled hasn’t already been finalized.
48 49 50 51 |
# File 'lib/nfoiled.rb', line 48 def finalize # TODO: Ensure finalization on fatal errors or interrupts finalize! if initialized? end |
.finalize! ⇒ Object
This method is responsible for tearing down any environment set up by the ‘Ncurses::initialize!` method.
38 39 40 41 42 43 |
# File 'lib/nfoiled.rb', line 38 def finalize! self.initialized = false ::Ncurses.endwin Terminal.terminals.each {|t| t.destroy! } Terminal.current, Terminal.default = nil end |
.initialize ⇒ Object
This module method ensures that Nfoiled is initialized. It simply calls ‘Nfoiled::initialize!` if Nfoiled hasn’t already been initialized.
30 31 32 |
# File 'lib/nfoiled.rb', line 30 def initialize initialize! unless initialized? end |
.initialize! ⇒ Object
This module method is responsible for setting up the entirety of Nfoiled’s overall environment. It will be called before any other Nfoiled functionality is allowed. In most cases, this will be called for you.
This method also schedules ‘Nfoiled::finalize` to be automatically run `at_exit`.
21 22 23 24 25 |
# File 'lib/nfoiled.rb', line 21 def initialize! self.initialized = true Terminal.default = Terminal.new unless Terminal.current at_exit { Nfoiled.finalize } end |