Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/objects.rb

Overview

Add the compile functionality to Ruby Numeric. Calling compile will add the cm, inch, bp metapost sizes to the to_s

Instance Method Summary collapse

Instance Method Details

#bpObject



185
186
187
188
# File 'lib/objects.rb', line 185

def bp
  @mpsize = 'bp'
  self
end

#cmObject



177
178
179
180
# File 'lib/objects.rb', line 177

def cm
  @mpsize = 'cm'
  self
end

#compileObject

A nifty thing here is that if you dont specify the size if wont print anything



191
192
193
194
# File 'lib/objects.rb', line 191

def compile
  #@mpsize='cm' if(@mpsize==nil)
  to_s + @mpsize.to_s
end

#inchObject



181
182
183
184
# File 'lib/objects.rb', line 181

def inch
  @mpsize = 'inch'
  self
end