Sha256: 82f28c21b18cba5ad4f704edcaf3eadb516320148948655ce0bd58b45e65dba3

Contents?: true

Size: 804 Bytes

Versions: 10

Compression:

Stored size: 804 Bytes

Contents

require 'squib/constants'

module Squib
  class Deck

    # Given inches, returns the number of pixels according to the deck's DPI.
    #
    # @example
    #   inches(2.5) # 750 (for default Deck::dpi of 300)
    #
    # @param n [Decimal], the number of inches
    # @return [Decimal] the number of pixels, according to the deck's DPI
    # @api public
    def inches(n)
      @dpi * n.to_f
    end

    # Given cm, returns the number of pixels according to the deck's DPI.
    #
    # @example
    #   cm(1) # 750 (for default Deck::dpi of 300)
    #
    # @param n [Decimal], the number of centimeters
    # @return [Decimal] the number of pixels, according to the deck's DPI
    # @api public
    def cm(n)
      @dpi * Squib::INCHES_IN_CM * n.to_f
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
squib-0.9.0 lib/squib/api/units.rb
squib-0.8.0 lib/squib/api/units.rb
squib-0.7.0 lib/squib/api/units.rb
squib-0.6.0 lib/squib/api/units.rb
squib-0.5.1 lib/squib/api/units.rb
squib-0.5.0 lib/squib/api/units.rb
squib-0.4.0 lib/squib/api/units.rb
squib-0.3.0 lib/squib/api/units.rb
squib-0.2.0 lib/squib/api/units.rb
squib-0.1.0 lib/squib/api/units.rb