Sha256: 4085035a0a880e373a0eafadbe748cae5f70343054af6edf1cccdd82eb649984

Contents?: true

Size: 978 Bytes

Versions: 70

Compression:

Stored size: 978 Bytes

Contents

Dir["web/views/*.rb"].each {|file| require file }

module SoarSc
  module Web
    class Renderer
      def render_view(detail, http_code, body)
        if detail['view']['renderer'] == 'haml'
          SoarSc::Web::Views::Default.render(http_code, SoarSc::Web::Views::HamlLoader::load(detail['view']['name'], body))
        elsif detail['view']['renderer'] == 'erb'
          SoarSc::Web::Views::Default.render(http_code, SoarSc::Web::Views::ERBLoader::load(detail['view']['name'], body))
        elsif detail['view']['renderer'] == 'html'
          SoarSc::Web::Views::Default.render(http_code, body)
        elsif detail['view']['renderer'] == 'json'
          SoarSc::Web::Views::JSON.render(http_code, body)
        elsif detail['view']['renderer'] == 'xml'
          SoarSc::Web::Views::XML.render(http_code, body)
        else
          Object::const_get(detail['view']['renderer']).new(@configuration).render(http_code, body)
        end
      end      
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
soar_sc_core-0.1.10 lib/web/renderer.rb
soar_sc_core-0.1.9 lib/web/renderer.rb
soar_sc_core-0.1.8 lib/web/renderer.rb
soar_sc_core-0.1.7 lib/web/renderer.rb
soar_sc_core-0.1.6 lib/web/renderer.rb
soar_sc_core-0.1.5 lib/web/renderer.rb
soar_sc_core-0.1.4 lib/web/renderer.rb
soar_sc_core-0.1.2 lib/web/renderer.rb
soar_sc_core-0.1.1 lib/web/renderer.rb
soar_sc_core-0.1.0 lib/web/renderer.rb