Class: Bio::SOFT::Table
Overview
:nodoc:
Defined Under Namespace
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#header_description ⇒ Object
Returns the value of attribute header_description.
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
- #add_header(line) ⇒ Object
- #add_header_or_row(line) ⇒ Object
- #add_row(line) ⇒ Object
-
#initialize ⇒ Table
constructor
A new instance of Table.
Constructor Details
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header.
198 199 200 |
# File 'lib/bio/db/soft.rb', line 198 def header @header end |
#header_description ⇒ Object
Returns the value of attribute header_description.
199 200 201 |
# File 'lib/bio/db/soft.rb', line 199 def header_description @header_description end |
#rows ⇒ Object
Returns the value of attribute rows.
200 201 202 |
# File 'lib/bio/db/soft.rb', line 200 def rows @rows end |
Instance Method Details
#add_header(line) ⇒ Object
246 247 248 249 250 251 252 |
# File 'lib/bio/db/soft.rb', line 246 def add_header( line ) raise "Can only define one header" unless @header.empty? @header = @header.concat( parse_row( line ) ) # beware of clobbering this into an Array @header.each_with_index do |key, i| @header.column_index[key.downcase.to_sym] = i end end |
#add_header_or_row(line) ⇒ Object
258 259 260 |
# File 'lib/bio/db/soft.rb', line 258 def add_header_or_row( line ) @header.empty? ? add_header( line ) : add_row( line ) end |