Sha256: bb9785151f810fdcb83a6d009b5495af88090fed915600fdbc944c5918559afd

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

module Straightedge
  # some boilerplate to bootstrap a rendering engine
  class Scene
    attr_reader :locations_and_figures

    def initialize(locations_and_figures={})
      @locations_and_figures = locations_and_figures
    end

    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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
straightedge-0.1.2 lib/straightedge/scene.rb