Class: String

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

Instance Method Summary collapse

Instance Method Details

#to_uObject



194
195
196
197
198
199
200
201
202
203
204
205
206
# 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