Class: IntervalList::Set

Inherits:
Object
  • Object
show all
Defined in:
lib/intervals.rb

Instance Method Summary collapse

Constructor Details

#initialize(array) ⇒ Set

Returns a new instance of Set.



233
234
235
236
237
238
# File 'lib/intervals.rb', line 233

def initialize array
  @seqs = {}
  array.each do |item|
    self << item
  end
end

Instance Method Details

#<<(item) ⇒ Object



240
241
242
243
# File 'lib/intervals.rb', line 240

def << item
  @seqs[item.seqname] ||= IntervalList::Tree.new
  @seqs[item.seqname] << item
end

#[](ind) ⇒ Object



244
245
246
# File 'lib/intervals.rb', line 244

def [] ind
  @seqs[ind]
end

#eachObject



247
248
249
250
251
# File 'lib/intervals.rb', line 247

def each
  @seqs.each do |seq|
    yield seq
  end
end

#inspectObject



252
253
254
# File 'lib/intervals.rb', line 252

def inspect
  "#<#{self.class}:0x#{'%x' % (object_id << 1)} @seqs=#{@seqs.keys}>"
end