class Bio::FlatFileIndex::FileIDs
FileIDs
class.
Internal use only.
Public Class Methods
new(prefix, hash)
click to toggle source
# File lib/bio/io/flatfile/index.rb 572 def initialize(prefix, hash) 573 @hash = hash 574 @prefix = prefix 575 end
Public Instance Methods
[](n)
click to toggle source
Calls superclass method
# File lib/bio/io/flatfile/index.rb 577 def [](n) 578 r = super(n) 579 if r then 580 r 581 else 582 data = @hash["#{@prefix}#{n}"] 583 if data then 584 self[n] = data 585 end 586 super(n) 587 end 588 end
[]=(n, data)
click to toggle source
Calls superclass method
# File lib/bio/io/flatfile/index.rb 590 def []=(n, data) 591 if data.is_a?(FileID) then 592 super(n, data) 593 elsif data then 594 super(n, FileID.new_from_string(data)) 595 else 596 # data is nil 597 super(n, nil) 598 end 599 self[n] 600 end
add(*arg)
click to toggle source
# File lib/bio/io/flatfile/index.rb 602 def add(*arg) 603 arg.each do |filename| 604 self << FileID.new(filename) 605 end 606 end
cache_all()
click to toggle source
# File lib/bio/io/flatfile/index.rb 608 def cache_all 609 a = @hash.keys.collect do |k| 610 if k =~ /\A#{Regexp.escape(@prefix)}(\d+)/ then 611 $1.to_i 612 else 613 nil 614 end 615 end 616 a.compact! 617 a.each do |i| 618 self[i] 619 end 620 a 621 end
check_all()
click to toggle source
# File lib/bio/io/flatfile/index.rb 657 def check_all 658 self.cache_all 659 r = true 660 self.each do |x| 661 r = x.check 662 break unless r 663 end 664 r 665 end
Also aliased as: check
close_all()
click to toggle source
# File lib/bio/io/flatfile/index.rb 668 def close_all 669 self.each do |x| 670 x.close 671 end 672 nil 673 end
Also aliased as: close
each() { |x| ... }
click to toggle source
# File lib/bio/io/flatfile/index.rb 623 def each 624 (0...self.size).each do |i| 625 x = self[i] 626 yield(x) if x 627 end 628 self 629 end
each_with_index() { |x, i| ... }
click to toggle source
# File lib/bio/io/flatfile/index.rb 631 def each_with_index 632 (0...self.size).each do |i| 633 x = self[i] 634 yield(x, i) if x 635 end 636 self 637 end
filenames()
click to toggle source
# File lib/bio/io/flatfile/index.rb 648 def filenames 649 self.cache_all 650 a = [] 651 self.each do |x| 652 a << x.filename 653 end 654 a 655 end
keys()
click to toggle source
# File lib/bio/io/flatfile/index.rb 639 def keys 640 self.cache_all 641 a = [] 642 (0...self.size).each do |i| 643 a << i if self[i] 644 end 645 a 646 end
recalc_all()
click to toggle source
# File lib/bio/io/flatfile/index.rb 676 def recalc_all 677 self.cache_all 678 self.each do |x| 679 x.recalc 680 end 681 true 682 end
Also aliased as: recalc