Sha256: 355ae16b5d25e1ef971876f9a9481f0d1fa2a1aba43ce9da27a6f182e9e3877a
Contents?: true
Size: 659 Bytes
Versions: 3
Compression:
Stored size: 659 Bytes
Contents
require_relative '../constants' module Squib module Args # :nodoc: # @api private module UnitConversion # :nodoc: # @api private module_function def parse(arg, dpi=300) case arg.to_s.rstrip when /in$/ # ends with "in" arg.rstrip[0..-2].to_f * dpi when /pt$/ # ends with "in" arg.rstrip[0..-2].to_f * dpi / POINTS_PER_IN when /cm$/ # ends with "cm" arg.rstrip[0..-2].to_f * dpi * INCHES_IN_CM when /mm$/ # ends with "mm" arg.rstrip[0..-2].to_f * dpi * INCHES_IN_CM / 10.0 else arg end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
squib-0.15.2 | lib/squib/args/unit_conversion.rb |
squib-0.15.1 | lib/squib/args/unit_conversion.rb |
squib-0.14.2 | lib/squib/args/unit_conversion.rb |