You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
774 B

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
@@INCHES_IN_CM = 0.393700787
# 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 * @@INCHES_IN_CM * n.to_f
end
end
end