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



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

def bp
  @mpsize = 'bp'
  self
end

#cmObject



183
184
185
186
# File 'lib/objects.rb', line 183

def cm
  @mpsize = 'cm'
  self
end

#compileObject

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



197
198
199
200
# File 'lib/objects.rb', line 197

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

#inchObject



187
188
189
190
# File 'lib/objects.rb', line 187

def inch
  @mpsize = 'inch'
  self
end