Module: RGhost::Units

Defined in:
lib/rghost/units.rb

Overview

doc.moveto :x => ‘100’ , :y => ‘200’

Defined Under Namespace

Classes: Cm, Inch, PSUnit, Unit

Class Method Summary collapse

Class Method Details

.parse(value) ⇒ Object

Parses units Units::DEFAULT=Utits::Cm Units.parse(2) #=> “2 cm” Units.parse(:current_row) #=> “current_row” Units.parse(“3 inch”) #=> “3 inch” Units.parse(“2”) #=> “2”

Using US metric

Units::DEFAULT=Utits::Inch
Units.parse(2)               #=> "2 inch"
Units.parse(:current_row)    #=> "current_row"
Units.parse("3 cm")          #=> "3 cm"
Units.parse("5")             #=> "5"


73
74
75
76
77
78
79
# File 'lib/rghost/units.rb', line 73

def self.parse(value)
  if value.is_a? Numeric
    RGhost::Config::GS[:unit].new(value)
  else
    RGhost::PsObject.new(value)
  end
end