class String

Public Instance Methods

to_u() click to toggle source
# File lib/paggio/css/unit.rb, line 194
def to_u
  if matches = match(/^([\d+.]+)(.+)?$/)
    value = matches[1].to_f

    if unit = matches[2]
      value.__send__(unit.downcase)
    else
      value
    end
  else
    0
  end
end