Module: Prawn::Measurements
- Included in:
- Numeric
- Defined in:
- lib/prawn/measurements.rb
Overview
Distance unit conversions between metric, imperial, and PDF.
Stable API collapse
-
#cm2mm(cm) ⇒ Number
Convert centimeter to millimeters.
-
#cm2pt(cm) ⇒ Number
Convert centimeters to points.
-
#dm2mm(dm) ⇒ Number
Convert decimeters to millimeters.
-
#dm2pt(dm) ⇒ Number
Convert decimeters to points.
-
#ft2in(ft) ⇒ Number
Convert feet to inches.
-
#ft2pt(ft) ⇒ Number
Convert feet to points.
-
#in2pt(inch) ⇒ Number
Convert inches to points.
-
#m2mm(m) ⇒ Number
Convert meters to millimeters.
-
#m2pt(m) ⇒ Number
Convert meters to points.
-
#mm2pt(mm) ⇒ Number
Convert millimeters to points.
-
#pt2mm(pt) ⇒ Number
Convert points to millimeters.
-
#pt2pt(pt) ⇒ Number
Convert points to points.
-
#yd2in(yd) ⇒ Number
Convert yards to inches.
-
#yd2pt(yd) ⇒ Number
Convert yards to points.
Instance Method Details
#cm2mm(cm) ⇒ Number
Convert centimeter to millimeters.
Source Code
15 | def cm2mm(cm) |
16 | cm * 10 |
17 | end
|
#cm2pt(cm) ⇒ Number
Convert centimeters to points.
Source Code
100 | def cm2pt(cm) |
101 | mm2pt(cm2mm(cm)) |
102 | end
|
#dm2mm(dm) ⇒ Number
Convert decimeters to millimeters.
Source Code
23 | def dm2mm(dm) |
24 | dm * 100 |
25 | end
|
#dm2pt(dm) ⇒ Number
Convert decimeters to points.
Source Code
108 | def dm2pt(dm) |
109 | mm2pt(dm2mm(dm)) |
110 | end
|
#ft2in(ft) ⇒ Number
Convert feet to inches.
Source Code
42 | def ft2in(ft) |
43 | ft * 12 |
44 | end
|
#ft2pt(ft) ⇒ Number
Convert feet to points.
Source Code
76 | def ft2pt(ft) |
77 | in2pt(ft2in(ft)) |
78 | end
|
#in2pt(inch) ⇒ Number
Convert inches to points.
Source Code
68 | def in2pt(inch) |
69 | inch * 72 |
70 | end
|
#m2mm(m) ⇒ Number
Convert meters to millimeters.
Source Code
31 | def m2mm(m) |
32 | m * 1000 |
33 | end
|
#m2pt(m) ⇒ Number
Convert meters to points.
Source Code
116 | def m2pt(m) |
117 | mm2pt(m2mm(m)) |
118 | end
|
#mm2pt(mm) ⇒ Number
Convert millimeters to points.
Source Code
92 | def mm2pt(mm) |
93 | mm * (72 / 25.4) |
94 | end
|
#pt2mm(pt) ⇒ Number
Convert points to millimeters.
Source Code
124 | def pt2mm(pt) |
125 | pt * 1 / mm2pt(1) # (25.4 / 72) |
126 | end
|
#pt2pt(pt) ⇒ Number
Convert points to points. For completeness.
Source Code
60 | def pt2pt(pt) |
61 | pt
|
62 | end
|
#yd2in(yd) ⇒ Number
Convert yards to inches.
Source Code
50 | def yd2in(yd) |
51 | yd * 36 |
52 | end
|
#yd2pt(yd) ⇒ Number
Convert yards to points.
Source Code
84 | def yd2pt(yd) |
85 | in2pt(yd2in(yd)) |
86 | end
|