Class: AsciiTable
- Inherits:
-
Object
- Object
- AsciiTable
- Defined in:
- lib/ascii_table.rb,
lib/ascii_table/version.rb
Defined Under Namespace
Classes: AbortError
Constant Summary collapse
- DELIMITER_MAP =
{ "t" => "\t", "0" => "\0", "v" => "\v", "r" => "\r" }
- VERSION =
"0.9.0"
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(args, reader) ⇒ AsciiTable
constructor
A new instance of AsciiTable.
- #to_s ⇒ Object
Constructor Details
#initialize(args, reader) ⇒ AsciiTable
Returns a new instance of AsciiTable.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ascii_table.rb', line 18 def initialize(args, reader) @table = nil @parser = nil @input = [] # defaults @options = OpenStruct.new( :delimiter => ";", :headings => false, :table_align => :left, :cell_align => {}, :separator => "" ) (args) read_input!(reader) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/ascii_table.rb', line 9 def @options end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
9 10 11 |
# File 'lib/ascii_table.rb', line 9 def parser @parser end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
9 10 11 |
# File 'lib/ascii_table.rb', line 9 def table @table end |
Instance Method Details
#to_s ⇒ Object
35 36 37 38 |
# File 'lib/ascii_table.rb', line 35 def to_s generate_table! unless @table @table.to_s end |