lib/molecules/empirical_formula.rb in bahuvrihi-molecules-0.1.0 vs lib/molecules/empirical_formula.rb in bahuvrihi-molecules-0.1.1

- old
+ new

@@ -37,11 +37,11 @@ formula = chemical_formula.to_s.gsub(/\s+/, "") factor = nil composition = Hash.new(0) scanner = StringScanner.new(formula.reverse) - while scanner.restsize > 0 + while scanner.rest_size > 0 case when scanner.scan_full(/\)(\d+-?)\(/, true, false) # found a factor factor = scanner[1].reverse.to_i when scanner.scan_full(/([a-z]?[A-Z])/, true, false) @@ -131,10 +131,10 @@ # composition will store the formula composition as it is parsed composition = Hash.new(0) # Parse elements and factors out of the formula from right to left scanner = StringScanner.new(formula.reverse) - while scanner.restsize > 0 + while scanner.rest_size > 0 case when scanner.scan_full(/(\d+)/, true, false) # found a factor factor = scanner[1].reverse.to_i