module Percentage::ScalarScannerPatch

Constants

DECIMAL
INTEGER

Public Instance Methods

tokenize(string) click to toggle source
Calls superclass method
# File lib/percentage/yaml.rb, line 13
def tokenize(string)
  if !string.empty? && string.match(INTEGER)
    return Percentage($1.to_i)
  end

  if !string.empty? && string.match(DECIMAL)
    return Percentage(BigDecimal($1))
  end

  super string
end