class Prawn::SVG::Percentage
Constants
- REGEXP
Public Class Methods
Source
# File lib/prawn/svg/percentage.rb, line 6 def self.parse(value, positive_only: false) if (matches = value.match(REGEXP)) number = Float(matches[1], exception: false) new(number) if number && (!positive_only || number >= 0) end end
Public Instance Methods
Source
# File lib/prawn/svg/percentage.rb, line 21 def to_pixels(axis_length, _font_size) value * axis_length / 100.0 end