Class: Bio::FlatFileIndex::Flat_1::Record
- Defined in:
- lib/bio/io/flatfile/index.rb
Overview
Record class.
Internal use only.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
DEBUG.print “key=#@[email protected],val=#@[email protected],size=#@sizen”.
-
#size ⇒ Object
readonly
DEBUG.print “key=#@[email protected],val=#@[email protected],size=#@sizen”.
-
#val ⇒ Object
readonly
DEBUG.print “key=#@[email protected],val=#@[email protected],size=#@sizen”.
Class Method Summary collapse
Instance Method Summary collapse
- #==(x) ⇒ Object
-
#initialize(str, size = nil) ⇒ Record
constructor
A new instance of Record.
- #to_s ⇒ Object
Constructor Details
#initialize(str, size = nil) ⇒ Record
Returns a new instance of Record.
696 697 698 699 700 701 702 703 |
# File 'lib/bio/io/flatfile/index.rb', line 696 def initialize(str, size = nil) a = str.split("\t") a.each { |x| x.to_s.gsub!(/[\000 ]+\z/, '') } @key = a.shift.to_s @val = a @size = (size or str.length) #DEBUG.print "key=#{@key.inspect},val=#{@val.inspect},size=#{@size}\n" end |
Instance Attribute Details
#key ⇒ Object (readonly)
DEBUG.print “key=#Bio::FlatFileIndex::Flat_1::Record.@[email protected],val=#Bio::FlatFileIndex::Flat_1::Record.@[email protected],size=#@sizen”
704 705 706 |
# File 'lib/bio/io/flatfile/index.rb', line 704 def key @key end |
#size ⇒ Object (readonly)
DEBUG.print “key=#Bio::FlatFileIndex::Flat_1::Record.@[email protected],val=#Bio::FlatFileIndex::Flat_1::Record.@[email protected],size=#@sizen”
704 705 706 |
# File 'lib/bio/io/flatfile/index.rb', line 704 def size @size end |
#val ⇒ Object (readonly)
DEBUG.print “key=#Bio::FlatFileIndex::Flat_1::Record.@[email protected],val=#Bio::FlatFileIndex::Flat_1::Record.@[email protected],size=#@sizen”
704 705 706 |
# File 'lib/bio/io/flatfile/index.rb', line 704 def val @val end |
Class Method Details
.create(size, key, val) ⇒ Object
714 715 716 |
# File 'lib/bio/io/flatfile/index.rb', line 714 def self.create(size, key, val) self.new(self.to_string(size, key, val)) end |
.to_string(size, key, val) ⇒ Object
710 711 712 |
# File 'lib/bio/io/flatfile/index.rb', line 710 def self.to_string(size, key, val) sprintf("%-*s", size, key + "\t" + val.join("\t")) end |