Module: FormatOutput
- Defined in:
- lib/format_output.rb,
lib/format_output/version.rb,
lib/format_output/builders/bullet_builder.rb,
lib/format_output/builders/column_builder.rb
Overview
Print out data in neat columns.
Defined Under Namespace
Classes: BulletPointBuilder, ColumnBuilder
Constant Summary collapse
- VERSION =
"0.1.3".freeze
- DESCRIPTION =
"Formatted output to the console or strings.".freeze
Class Method Summary collapse
-
.body(options = {}) ⇒ Object
Get the working page width.
-
.body=(value) ⇒ Object
Set the working page width.
-
.left(options = {}) ⇒ Object
Get the left margin.
-
.left=(value) ⇒ Object
Set the left margin.
-
.pad(options = {}) ⇒ Object
The left margin pad string.
-
.right(options = {}) ⇒ Object
Get the left margin.
-
.right=(value) ⇒ Object
Set the right margin.
-
.width(options = {}) ⇒ Object
Get the full page width.
-
.width=(value) ⇒ Object
Set the full page width.
Class Method Details
.body(options = {}) ⇒ Object
Get the working page width.
33 34 35 |
# File 'lib/format_output.rb', line 33 def body( = {}) width() - (left() + right()) end |
.body=(value) ⇒ Object
Set the working page width. Note always set after left and right are set.
39 40 41 |
# File 'lib/format_output.rb', line 39 def body=(value) @width = value.to_i + @left + @right end |
.left(options = {}) ⇒ Object
Get the left margin
44 45 46 |
# File 'lib/format_output.rb', line 44 def left( = {}) ([:left] || @left).to_i end |
.left=(value) ⇒ Object
Set the left margin
49 50 51 |
# File 'lib/format_output.rb', line 49 def left=(value) @left = value.to_i end |
.pad(options = {}) ⇒ Object
The left margin pad string.
64 65 66 |
# File 'lib/format_output.rb', line 64 def pad( = {}) " " * left() end |
.right(options = {}) ⇒ Object
Get the left margin
54 55 56 |
# File 'lib/format_output.rb', line 54 def right( = {}) ([:right] || @right).to_i end |
.right=(value) ⇒ Object
Set the right margin
59 60 61 |
# File 'lib/format_output.rb', line 59 def right=(value) @right = value.to_i end |
.width(options = {}) ⇒ Object
Get the full page width.
23 24 25 |
# File 'lib/format_output.rb', line 23 def width( = {}) ([:width] || @width).to_i end |
.width=(value) ⇒ Object
Set the full page width.
28 29 30 |
# File 'lib/format_output.rb', line 28 def width=(value) @width = value.to_i end |