lib/parse_fasta/quality.rb in parse_fasta-1.7.1 vs lib/parse_fasta/quality.rb in parse_fasta-1.7.2

- old
+ new

@@ -17,9 +17,20 @@ # along with parse_fasta. If not, see <http://www.gnu.org/licenses/>. # Provide some methods for dealing with common tasks regarding # quality strings. class Quality < String + + # Strips whitespace from the str argument before calling super + # + # @return [Quality] A Quality string + # + # @example Removes whitespace + # Quality.new "I I 2 ! " #=> "II2!" + def initialize(str) + super(str.gsub(/ +/, "")) + end + # Returns the mean quality for the record. This will be a good deal # faster than getting the average with `qual_scores` and reduce. # # @example Get mean quality score for a record # Quality.new("!+5?I").mean_qual #=> 20.0