module MonoclePrint

author: Kyle Yetter

require ‘termios’ require ‘terminfo’

Constants

COLOR_ESCAPE
FOUR_BYTES
Graphics
MULTIBYTE_CHARACTER
ONE_BYTE
Pair
Rectangle
THREE_BYTES
TWO_BYTES
VERSION

Public Class Methods

buffer( options = {}, &block ) click to toggle source
# File lib/monocle-print.rb, line 37
def self.buffer( options = {}, &block )
  OutputDevice.buffer( options, &block )
end
included( kl ) click to toggle source
Calls superclass method
# File lib/monocle-print.rb, line 20
def self.included( kl )
  super
  kl.extend( self )
end
library_path( *args ) click to toggle source
# File lib/monocle-print.rb, line 25
def self.library_path( *args )
  File.join( File.dirname( __FILE__ ), *args )
end
stderr( options = {}, &block ) click to toggle source
# File lib/monocle-print.rb, line 33
def self.stderr( options = {}, &block )
  OutputDevice.stderr( options, &block )
end
stdout( options = {}, &block ) click to toggle source
# File lib/monocle-print.rb, line 29
def self.stdout( options = {}, &block )
  OutputDevice.stdout( options, &block )
end
version() click to toggle source
# File lib/monocle-print.rb, line 16
def self.version
  VERSION
end

Public Instance Methods

Line( obj ) click to toggle source
# File lib/monocle-print.rb, line 43
def Line( obj )
  SingleLine === obj ? obj : SingleLine.new( obj.to_s )
end
Output( dev ) click to toggle source
# File lib/monocle-print.rb, line 47
def Output( dev )
  OutputDevice === dev ? dev : OutputDevice.new( dev )
end
Rectangle( obj ) click to toggle source
# File lib/monocle-print.rb, line 63
def Rectangle( obj )
  case obj
  when Rectangle then obj
  when Array then Rectangle.new( *obj )
  when Hash then Rectangle.create( obj )
  else Rectangle.new( obj )
  end
end
Style( obj ) click to toggle source
# File lib/monocle-print.rb, line 59
def Style( obj )
  Graphics === obj ? obj : Graphics.style( obj )
end
Text( obj ) click to toggle source
# File lib/monocle-print.rb, line 51
def Text( obj )
  case obj
  when Text then obj
  when nil then Text.new( '' )
  else Text.new( obj.to_s )
  end
end