Module: Prawn::Measurements

Included in:
Numeric
Defined in:
lib/prawn/measurements.rb

Stable API collapse

Instance Method Details

#cm2mm(cm) ⇒ Object

metric conversions



14
15
16
# File 'lib/prawn/measurements.rb', line 14

def cm2mm(cm)
  cm * 10
end

#cm2pt(cm) ⇒ Object



57
58
59
# File 'lib/prawn/measurements.rb', line 57

def cm2pt(cm)
  mm2pt(cm2mm(cm))
end

#dm2mm(dm) ⇒ Object



18
19
20
# File 'lib/prawn/measurements.rb', line 18

def dm2mm(dm)
  dm * 100
end

#dm2pt(dm) ⇒ Object



61
62
63
# File 'lib/prawn/measurements.rb', line 61

def dm2pt(dm)
  mm2pt(dm2mm(dm))
end

#ft2in(ft) ⇒ Object

imperial conversions from en.wikipedia.org/wiki/Imperial_units



28
29
30
# File 'lib/prawn/measurements.rb', line 28

def ft2in(ft)
  ft * 12
end

#ft2pt(ft) ⇒ Object



45
46
47
# File 'lib/prawn/measurements.rb', line 45

def ft2pt(ft)
  in2pt(ft2in(ft))
end

#in2pt(inch) ⇒ Object



41
42
43
# File 'lib/prawn/measurements.rb', line 41

def in2pt(inch)
  inch * 72
end

#m2mm(m) ⇒ Object



22
23
24
# File 'lib/prawn/measurements.rb', line 22

def m2mm(m)
  m * 1000
end

#m2pt(m) ⇒ Object



65
66
67
# File 'lib/prawn/measurements.rb', line 65

def m2pt(m)
  mm2pt(m2mm(m))
end

#mm2pt(mm) ⇒ Object



53
54
55
# File 'lib/prawn/measurements.rb', line 53

def mm2pt(mm)
  mm * (72 / 25.4)
end

#pt2mm(pt) ⇒ Object



69
70
71
# File 'lib/prawn/measurements.rb', line 69

def pt2mm(pt)
  pt * 1 / mm2pt(1) # (25.4 / 72)
end

#pt2pt(pt) ⇒ Object

PostscriptPoint-converisons



37
38
39
# File 'lib/prawn/measurements.rb', line 37

def pt2pt(pt)
  pt
end

#yd2in(yd) ⇒ Object



32
33
34
# File 'lib/prawn/measurements.rb', line 32

def yd2in(yd)
  yd * 36
end

#yd2pt(yd) ⇒ Object



49
50
51
# File 'lib/prawn/measurements.rb', line 49

def yd2pt(yd)
  in2pt(yd2in(yd))
end