Class: IntervalList::Set
- Inherits:
-
Object
- Object
- IntervalList::Set
- Defined in:
- lib/intervals.rb
Instance Method Summary collapse
- #<<(item) ⇒ Object
- #[](ind) ⇒ Object
- #each ⇒ Object
-
#initialize(array) ⇒ Set
constructor
A new instance of Set.
- #inspect ⇒ Object
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 |
#each ⇒ Object
247 248 249 250 251 |
# File 'lib/intervals.rb', line 247 def each @seqs.each do |seq| yield seq end end |
#inspect ⇒ Object
252 253 254 |
# File 'lib/intervals.rb', line 252 def inspect "#<#{self.class}:0x#{'%x' % (object_id << 1)} @seqs=#{@seqs.keys}>" end |