Class: HTS::Bam::Cigar
- Inherits:
-
Object
- Object
- HTS::Bam::Cigar
- Includes:
- Enumerable
- Defined in:
- lib/hts/bam/cigar.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(pointer, n_cigar) ⇒ Cigar
constructor
A new instance of Cigar.
- #to_ptr ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(pointer, n_cigar) ⇒ Cigar
Returns a new instance of Cigar.
11 12 13 14 |
# File 'lib/hts/bam/cigar.rb', line 11 def initialize(pointer, n_cigar) @pointer = pointer @n_cigar = n_cigar end |
Instance Method Details
#each ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/hts/bam/cigar.rb', line 24 def each return to_enum(__method__) unless block_given? @n_cigar.times do |i| c = @pointer[i].read_uint32 yield [LibHTS.bam_cigar_oplen(c), LibHTS.bam_cigar_opchr(c)] end end |
#to_ptr ⇒ Object
16 17 18 |
# File 'lib/hts/bam/cigar.rb', line 16 def to_ptr @pointer end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/hts/bam/cigar.rb', line 20 def to_s to_a.flatten.join end |