Class: RubyPost::Figure
Overview
wrapper for the metapost figure Figures actually become the figures that will to be viewed
Instance Method Summary collapse
- #add_drawable(d) ⇒ Object
- #compile ⇒ Object
-
#initialize ⇒ Figure
constructor
A new instance of Figure.
Constructor Details
#initialize ⇒ Figure
Returns a new instance of Figure.
165 166 167 |
# File 'lib/objects.rb', line 165 def initialize @draw_commands = Array.new end |
Instance Method Details
#add_drawable(d) ⇒ Object
169 170 171 |
# File 'lib/objects.rb', line 169 def add_drawable(d) @draw_commands.push(d) end |
#compile ⇒ Object
173 174 175 176 177 178 179 180 |
# File 'lib/objects.rb', line 173 def compile str = String.new @draw_commands.each do |d| str = str + d.compile + "\n" end str = str + "endfig;\n" return str end |