Module: Facades::SassExtensions::Conversions
- Defined in:
- lib/facades/sass_extensions/conversions.rb
Instance Method Summary collapse
-
#numeric(value) ⇒ Object
Removes any unit values (px/em/rem etc) from a number leaving just the numeric representation.
Instance Method Details
#numeric(value) ⇒ Object
Removes any unit values (px/em/rem etc) from a number leaving just the numeric representation.
17 18 19 20 21 22 23 |
# File 'lib/facades/sass_extensions/conversions.rb', line 17 def numeric(value) assert_type value, :Number return value if value.unitless? value = value.to_s.gsub(value.unit_str, '') value = value.to_f.denominator > 1 ? value.to_f : value.to_i Sass::Script::Number.new(value) end |