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.
151 152 153 |
# File 'lib/objects.rb', line 151 def initialize @draw_commands = Array.new end |
Instance Method Details
#add_drawable(d) ⇒ Object
155 156 157 |
# File 'lib/objects.rb', line 155 def add_drawable(d) @draw_commands.push(d) end |
#compile ⇒ Object
159 160 161 162 163 164 165 166 |
# File 'lib/objects.rb', line 159 def compile str = String.new @draw_commands.each do |d| str = str + d.compile + "\n" end str = str + "endfig;\n" return str end |