Class: Prawn::SVG::Calculators::Pixels::Measurement
- Inherits:
-
Object
- Object
- Prawn::SVG::Calculators::Pixels::Measurement
- Defined in:
- lib/prawn/svg/calculators/pixels.rb
Class Method Summary collapse
Class Method Details
.to_pixels(value, axis_length = nil, font_size: Prawn::SVG::Properties::EM) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/prawn/svg/calculators/pixels.rb', line 3 def self.to_pixels(value, axis_length = nil, font_size: Prawn::SVG::Properties::EM) if value.respond_to?(:to_pixels) value.to_pixels(axis_length, font_size) elsif value.is_a?(String) value = value.strip value = Prawn::SVG::Length.parse(value) || Prawn::SVG::Percentage.parse(value) value&.to_pixels(axis_length, font_size) || 0.0 elsif value value.to_f end end |