class Straightedge::Scene

some boilerplate to bootstrap a rendering engine

Attributes

locations_and_figures[R]

Public Class Methods

new(locations_and_figures={}) click to toggle source
# File lib/straightedge/scene.rb, line 6
def initialize(locations_and_figures={})
  @locations_and_figures = locations_and_figures
end
render_figure(figure,location,adapter) click to toggle source
# File lib/straightedge/scene.rb, line 23
def self.render_figure(figure,location,adapter)
  figure = Figures::Label.new.says(figure) if figure.is_a?(String)
  figure.location = location
  presenter = adapter.presenter_for(figure)
  presenter.display(figure)
end

Public Instance Methods

render(adapter=nil) click to toggle source
# File lib/straightedge/scene.rb, line 10
def render(adapter=nil)
  return false unless adapter
  @locations_and_figures.each do |location,f|
    if f.is_a?(Array)
      f.map do |figure|
        Scene.render_figure(figure, location,adapter)
      end
    else
      Scene.render_figure(f, location,adapter)
    end
  end
end