lib/qlang/api.rb in qlang-0.0.14142 vs lib/qlang/api.rb in qlang-0.0.141421

- old
+ new

@@ -7,17 +7,33 @@ module Qlang module Api # TODO: class ::String def rm(str_or_rgx) + gsub(str_or_rgx, '') + end + + def rm!(str_or_rgx) gsub!(str_or_rgx, '') + self end - def rms(*str_or_rgxs) + def rms!(*str_or_rgxs) str_or_rgxs.each do |str_or_rgx| - rm(str_or_rgx) + rm!(str_or_rgx) end self + end + + # FIX: + def equalize! + rms!(/\A +/, / +\z/) + if self =~ /\A\(/ && self =~ /\)\z/ + rms!(/\A\(/, /\)\z/) + rms!(/\A +/, / +\z/) + else + self + end end end class ::Matrix def to_q