Class: MonoclePrint::Graphics
- Inherits:
-
Struct
- Object
- Struct
- MonoclePrint::Graphics
- Extended by:
- GraphicsRegistry
- Includes:
- MonoclePrint
- Defined in:
- lib/monocle-print/graphics.rb,
lib/monocle-print/graphics.rb
Constant Summary
Constants included from GraphicsRegistry
MonoclePrint::GraphicsRegistry::ENV_KEY, MonoclePrint::GraphicsRegistry::FALLBACK_STYLE
Constants included from MonoclePrint
COLOR_ESCAPE, FOUR_BYTES, MULTIBYTE_CHARACTER, ONE_BYTE, THREE_BYTES, TWO_BYTES, VERSION
Instance Attribute Summary collapse
-
#blank ⇒ Object
Returns the value of attribute blank.
-
#en ⇒ Object
Returns the value of attribute en.
-
#ens ⇒ Object
Returns the value of attribute ens.
-
#ensw ⇒ Object
Returns the value of attribute ensw.
-
#enw ⇒ Object
Returns the value of attribute enw.
-
#es ⇒ Object
Returns the value of attribute es.
-
#esw ⇒ Object
Returns the value of attribute esw.
-
#ew ⇒ Object
(also: #h)
Returns the value of attribute ew.
-
#ns ⇒ Object
(also: #v)
Returns the value of attribute ns.
-
#nsw ⇒ Object
Returns the value of attribute nsw.
-
#nw ⇒ Object
Returns the value of attribute nw.
-
#sw ⇒ Object
Returns the value of attribute sw.
-
#tree_fork ⇒ Object
Returns the value of attribute tree_fork.
-
#tree_tail ⇒ Object
Returns the value of attribute tree_tail.
Attributes included from GraphicsRegistry
Instance Method Summary collapse
- #box_bottom(width) ⇒ Object
- #box_top(width) ⇒ Object
- #format(description) ⇒ Object
- #horizontal_line(width) ⇒ Object
- #line_with_joints(joint, *widths) ⇒ Object
- #table_bottom(*column_widths) ⇒ Object
- #table_divide(*column_widths) ⇒ Object
- #table_top(*column_widths) ⇒ Object
Methods included from GraphicsRegistry
default, define, named_styles, style, style?, styles
Methods included from MonoclePrint
Line, Output, Rectangle, Style, Text, buffer, included, library_path, stderr, stdout, version
Instance Attribute Details
#blank ⇒ Object
Returns the value of attribute blank
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def blank @blank end |
#en ⇒ Object
Returns the value of attribute en
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def en @en end |
#ens ⇒ Object
Returns the value of attribute ens
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def ens @ens end |
#ensw ⇒ Object
Returns the value of attribute ensw
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def ensw @ensw end |
#enw ⇒ Object
Returns the value of attribute enw
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def enw @enw end |
#es ⇒ Object
Returns the value of attribute es
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def es @es end |
#esw ⇒ Object
Returns the value of attribute esw
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def esw @esw end |
#ew ⇒ Object Also known as: h
Returns the value of attribute ew
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def ew @ew end |
#ns ⇒ Object Also known as: v
Returns the value of attribute ns
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def ns @ns end |
#nsw ⇒ Object
Returns the value of attribute nsw
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def nsw @nsw end |
#nw ⇒ Object
Returns the value of attribute nw
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def nw @nw end |
#sw ⇒ Object
Returns the value of attribute sw
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def sw @sw end |
#tree_fork ⇒ Object
Returns the value of attribute tree_fork
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def tree_fork @tree_fork end |
#tree_tail ⇒ Object
Returns the value of attribute tree_tail
7 8 9 |
# File 'lib/monocle-print/graphics.rb', line 7 def tree_tail @tree_tail end |
Instance Method Details
#box_bottom(width) ⇒ Object
51 52 53 |
# File 'lib/monocle-print/graphics.rb', line 51 def box_bottom( width ) format( "<ne><ew:#{ width }><nw>" ) end |
#box_top(width) ⇒ Object
47 48 49 |
# File 'lib/monocle-print/graphics.rb', line 47 def box_top( width ) format( "<se><ew:#{ width }><sw>" ) end |
#format(description) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/monocle-print/graphics.rb', line 34 def format( description ) out = Line( description ) out.gsub!( /<([nsewlrtbudhv]+)(?::(\d+))?>/i ) do box_bit = resolve_name( $1 ) $2 ? box_bit.tile( $2.to_i ) : box_bit end return( out ) end |
#horizontal_line(width) ⇒ Object
43 44 45 |
# File 'lib/monocle-print/graphics.rb', line 43 def horizontal_line( width ) ew.tile( width ) end |
#line_with_joints(joint, *widths) ⇒ Object
67 68 69 |
# File 'lib/monocle-print/graphics.rb', line 67 def line_with_joints( joint, *widths ) widths.map { | w | horizontal_line( w ) }.join( joint ) end |
#table_bottom(*column_widths) ⇒ Object
63 64 65 |
# File 'lib/monocle-print/graphics.rb', line 63 def table_bottom( *column_widths ) sw + line_with_joints( enw, column_widths ) + se end |
#table_divide(*column_widths) ⇒ Object
59 60 61 |
# File 'lib/monocle-print/graphics.rb', line 59 def table_divide( *column_widths ) ens + line_with_joints( ensw, column_widths ) + nsw end |
#table_top(*column_widths) ⇒ Object
55 56 57 |
# File 'lib/monocle-print/graphics.rb', line 55 def table_top( *column_widths ) nw + line_with_joints( esw, column_widths ) + ne end |