Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/paggio/css/unit.rb

Instance Method Summary collapse

Instance Method Details

#to_uObject



181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/paggio/css/unit.rb', line 181

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