Module: MonoclePrint

Included in:
Graphics, OutputDevice, Presentation, SingleLine, Table, Table::Column, Table::Member, Table::Segments, Text
Defined in:
lib/monocle-print/terminal-escapes.rb,
lib/monocle-print.rb,
lib/monocle-print/list.rb,
lib/monocle-print/table.rb,
lib/monocle-print/utils.rb,
lib/monocle-print/atomic.rb,
lib/monocle-print/layout.rb,
lib/monocle-print/geometry.rb,
lib/monocle-print/graphics.rb,
lib/monocle-print/progress.rb,
lib/monocle-print/presentation.rb,
lib/monocle-print/table/column.rb,
lib/monocle-print/output-device.rb,
lib/monocle-print/table/members.rb,
lib/monocle-print/table/segments.rb,
lib/monocle-print/graphics/registry.rb

Overview

author: Kyle Yetter

Defined Under Namespace

Modules: GraphicsRegistry, Presentation, TerminalEscapes, Utils Classes: ColumnLayout, Flow, Graphics, Horizontal, Layout, List, OutputDevice, Pager, Pair, Progress, Rectangle, SingleLine, Table, Text, Vertical

Constant Summary collapse

VERSION =
'1.1.0'
MULTIBYTE_CHARACTER =
%r<
  [\xC2-\xDF][\x80-\xBF]
| [\xE0-\xEF][\x80-\xBF]{2}
| [\xF0-\xF4][\x80-\xBF]{3}
>x
ONE_BYTE =
0x20 .. 0x7E
TWO_BYTES =
0xC2 .. 0xDF
THREE_BYTES =
0xE0 .. 0xEF
FOUR_BYTES =
0xF0 .. 0xF4
COLOR_ESCAPE =
/\e\[[\d:;]*?m/

Class Method Summary collapse

Class Method Details

.buffer(options = {}, &block) ⇒ Object



37
38
39
# File 'lib/monocle-print.rb', line 37

def self.buffer( options = {}, &block )
  OutputDevice.buffer( options, &block )
end

.included(kl) ⇒ Object



20
21
22
23
# File 'lib/monocle-print.rb', line 20

def self.included( kl )
  super
  kl.extend( self )
end

.library_path(*args) ⇒ Object



25
26
27
# File 'lib/monocle-print.rb', line 25

def self.library_path( *args )
  File.join( File.dirname( __FILE__ ), *args )
end

.Line(obj) ⇒ Object



43
44
45
# File 'lib/monocle-print.rb', line 43

def Line( obj )
  SingleLine === obj ? obj : SingleLine.new( obj.to_s )
end

.Output(dev) ⇒ Object



47
48
49
# File 'lib/monocle-print.rb', line 47

def Output( dev )
  OutputDevice === dev ? dev : OutputDevice.new( dev )
end

.Rectangle(obj) ⇒ Object



63
64
65
66
67
68
69
70
# 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

.stderr(options = {}, &block) ⇒ Object



33
34
35
# File 'lib/monocle-print.rb', line 33

def self.stderr( options = {}, &block )
  OutputDevice.stderr( options, &block )
end

.stdout(options = {}, &block) ⇒ Object



29
30
31
# File 'lib/monocle-print.rb', line 29

def self.stdout( options = {}, &block )
  OutputDevice.stdout( options, &block )
end

.Style(obj) ⇒ Object



59
60
61
# File 'lib/monocle-print.rb', line 59

def Style( obj )
  Graphics === obj ? obj : Graphics.style( obj )
end

.Text(obj) ⇒ Object



51
52
53
54
55
56
57
# 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

.versionObject



16
17
18
# File 'lib/monocle-print.rb', line 16

def self.version
  VERSION
end