Sha256: bb4bc238c5021f07198932858c7b23a9a6ab8261274478c1eb0c31d7bdfceacf

Contents?: true

Size: 732 Bytes

Versions: 3

Compression:

Stored size: 732 Bytes

Contents

require_relative '../constants'

module Squib
  class Deck

    # DSL method. See http://squib.readthedocs.io
    def inches(n)
      @dpi * n.to_f
    end

    # DSL method. See http://squib.readthedocs.io
    def points(n)
      @dpi / Squib::POINTS_PER_IN * n.to_f
    end

    # DSL method. See http://squib.readthedocs.io
    def cm(n)
      @dpi * Squib::INCHES_IN_CM * n.to_f
    end

    # DSL method. See http://squib.readthedocs.io
    def mm(n)
      @dpi * Squib::INCHES_IN_CM * n.to_f / 10.0
    end

    # DSL method. See http://squib.readthedocs.io
    def deg(n)
      n.to_f * (Math::PI / 180.0)
    end

    # DSL method. See http://squib.readthedocs.io
    def cells(n)
      n.to_f * @cell_px
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
squib-0.19.0 lib/squib/dsl/units.rb
squib-0.19.0b lib/squib/dsl/units.rb
squib-0.19.0a lib/squib/dsl/units.rb