Make Method Chaining Fun
kojix2 opened this issue · 0 comments
kojix2 commented
Currently, ruby-htslib methods are not that easy to method chain. However, in Ruby programming, method chaining is a lot of fun, kind of like %>% in the R language.
To make this work, you need to make sure that many methods return self
.
With that change, Ruby should be able to detect htslib errors.
A typical code might look like this:
def magical_method(sesame)
r = LibHTS.hts_magical_method(sesame)
raise "Error" if r < 0
self
end