Class: MonoclePrint::Pager

Inherits:
OutputDevice show all
Defined in:
lib/monocle-print/output-device.rb

Constant Summary collapse

PAGER_COMMAND =
pager_command

Constants inherited from OutputDevice

OutputDevice::DEFAULT_SIZE, OutputDevice::IO_PRINT_METHODS, OutputDevice::SIZE_IOCTL, OutputDevice::SIZE_STRUCT

Constants included from TerminalEscapes

TerminalEscapes::ANSI_COLORS

Constants included from MonoclePrint

COLOR_ESCAPE, FOUR_BYTES, MULTIBYTE_CHARACTER, ONE_BYTE, THREE_BYTES, TWO_BYTES, VERSION

Instance Attribute Summary

Attributes inherited from OutputDevice

#device, #style

Class Method Summary collapse

Methods inherited from OutputDevice

#background, buffer, #clear, #clear_line, #close, #color_code, #colors, #column, #column_layout, #fill, #foreground, #full_width, #height, #indent, #initialize, #left_margin, #left_margin=, #leger, #line, #list, #margin=, #newline!, #outdent, #print, #printf, #put, #put!, #puts, #putsf, #reset!, #return!, #right_margin, #right_margin=, #space, stderr, stdout, #table, #use_color, #use_color=, #width

Methods included from TerminalEscapes

ansi_color, blink, bold, clear_attr, clear_down, clear_left, clear_line, clear_right, clear_screen, clear_up, conceal, cursor_backward, cursor_down, cursor_forward, cursor_up, dobule_height_bottom, double_height_top, double_width, konsole_color, restore_cursor, reverse, save_cursor, set_cursor, single_width, underline, xterm_color

Methods included from MonoclePrint

Line, Output, Rectangle, Style, Text, buffer, included, library_path, stderr, stdout, version

Constructor Details

This class inherits a constructor from MonoclePrint::OutputDevice

Class Method Details

.open(options = {}) ⇒ Object



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/monocle-print/output-device.rb', line 456

def self.open( options = {} )
  unless PAGER_COMMAND
    message = "    unable to locate a pager program on the system's PATH or from\n    the environmental variable, PAGER\n    END\n    raise( IOError, message )\n  end\n\n  options.fetch( :use_color ) { options[ :use_color ] = true }\n\n  if block_given?\n    IO.popen( PAGER_COMMAND, 'w' ) do | pager |\n      pager = new( pager, options )\n      return yield( pager )\n    end\n  else\n    return new( IO.popen( PAGER_COMMAND, 'w' ), options )\n  end\nend\n".gsub!( /\s+/, ' ' ).strip!