Sha256: aa2aea50640a0c739721d1eb16dc33bf8efb07efc67bdd12532a620373081b05
Contents?: true
Size: 566 Bytes
Versions: 4
Compression:
Stored size: 566 Bytes
Contents
module Prawn::SVG::Calculators class Pixels extend Prawn::Measurements def self.to_pixels(value, axis_length) if value.is_a?(String) if match = value.match(/\d(cm|dm|ft|in|m|mm|yd)$/) send("#{match[1]}2pt", value.to_f) elsif match = value.match(/\dpc$/) value.to_f * 15 # according to http://www.w3.org/TR/SVG11/coords.html elsif value[-1..-1] == "%" value.to_f * axis_length / 100.0 else value.to_f end elsif value value.to_f end end end end
Version data entries
4 entries across 4 versions & 1 rubygems