Class: Numeric

Inherits:
Object
  • Object
show all
Includes:
Prawn::Measurements
Defined in:
lib/prawn/measurement_extensions.rb

Overview

Core extensions for Prawn::Measurements.

This mainly enables measurements DSL.

You have to explicitly require “prawn/measurement_extensions” to enable these.

“‘ruby require ’prawn/measurement_extensions’

12.mm 2.cm 0.5.in 4.yd + 2.ft “‘

Experimental API collapse

Methods included from Prawn::Measurements

#cm2mm, #cm2pt, #dm2mm, #dm2pt, #ft2in, #ft2pt, #in2pt, #m2mm, #m2pt, #mm2pt, #pt2mm, #pt2pt, #yd2in, #yd2pt

Instance Method Details

#cmNumber

Convert from centimeters to points.

Returns:

  • (Number)


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

def cm
  cm2pt(self)
end

#dmNumber

Convert from decimeters to points.

Returns:

  • (Number)


44
45
46
# File 'lib/prawn/measurement_extensions.rb', line 44

def dm
  dm2pt(self)
end

#ftNumber

Convert from feet to points.

Returns:

  • (Number)


72
73
74
# File 'lib/prawn/measurement_extensions.rb', line 72

def ft
  ft2pt(self)
end

#inNumber

Convert from inches to points.

Returns:

  • (Number)


58
59
60
# File 'lib/prawn/measurement_extensions.rb', line 58

def in
  in2pt(self)
end

#mNumber

Convert from meters to points.

Returns:

  • (Number)


51
52
53
# File 'lib/prawn/measurement_extensions.rb', line 51

def m
  m2pt(self)
end

#mmNumber

Convert from millimeters to points.

Returns:

  • (Number)


30
31
32
# File 'lib/prawn/measurement_extensions.rb', line 30

def mm
  mm2pt(self)
end

#ptNumber

Convert from points to points.

Returns:

  • (Number)


79
80
81
# File 'lib/prawn/measurement_extensions.rb', line 79

def pt
  pt2pt(self)
end

#ydNumber

Convert from yards to points.

Returns:

  • (Number)


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

def yd
  yd2pt(self)
end