Class | Bio::FlatFileIndex::NameSpaces
In: | lib/bio/io/flatfile/index.rb
Parent: | Hash

namespaces

Internal use only.

### Methods

close close_all each_files each_names names new search search_names to_s

### Public Class methods

new(dbname, nsclass, arg)

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1056
    1056:       def initialize(dbname, nsclass, arg)
    1057:         @dbname = dbname
    1058:         @nsclass = nsclass
    1059:         if arg.is_a?(String) then
    1060:           a = arg.split("\t")
    1061:         else
    1062:           a = arg
    1063:         end
    1064:         a.each do |x|
    1065:           self[x] = @nsclass.new(@dbname, x)
    1066:         end
    1067:         self
    1068:       end

### Public Instance methods

close()

Alias for close_all

close_all()

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1086
    1086:       def close_all
    1087:         values.each { |x| x.file.close }
    1088:       end

each_files() {|x| ...}

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1076
    1076:       def each_files
    1077:         self.values.each do |x|
    1078:           yield x
    1079:         end
    1080:       end

each_names() {|x| ...}

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1070
    1070:       def each_names
    1071:         self.names.each do |x|
    1072:           yield x
    1073:         end
    1074:       end

names()

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1082
    1082:       def names
    1083:         keys
    1084:       end

search(key)

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1091
    1091:       def search(key)
    1092:         r = []
    1093:         values.each do |ns|
    1094:           r.concat ns.search(key)
    1095:         end
    1096:         r.sort!
    1097:         r.uniq!
    1098:         r
    1099:       end

search_names(key, *names)

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1101
    1101:       def search_names(key, *names)
    1102:         r = []
    1103:         names.each do |x|
    1104:           ns = self[x]
    1105:           raise "undefined namespace #{x.inspect}" unless ns
    1106:           r.concat ns.search(key)
    1107:         end
    1108:         r
    1109:       end

to_s()

[Source]

          # File lib/bio/io/flatfile/index.rb, line 1111
    1111:       def to_s
    1112:         names.join("\t")
    1113:       end

[Validate]