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.8.0 lib/web/renderer.rb
soar_sc_core-0.7.1 lib/web/renderer.rb
soar_sc_core-0.7.0 lib/web/renderer.rb
soar_sc_core-0.6.0 lib/web/renderer.rb
soar_sc_core-0.5.0 lib/web/renderer.rb
soar_sc_core-0.4.0 lib/web/renderer.rb
soar_sc_core-0.3.0 lib/web/renderer.rb
soar_sc_core-0.2.0 lib/web/renderer.rb
soar_sc_core-0.1.22 lib/web/renderer.rb
soar_sc_core-0.1.21 lib/web/renderer.rb
soar_sc_core-0.1.20 lib/web/renderer.rb
soar_sc_core-0.1.19 lib/web/renderer.rb
soar_sc_core-0.1.18 lib/web/renderer.rb
soar_sc_core-0.1.17 lib/web/renderer.rb
soar_sc_core-0.1.16 lib/web/renderer.rb
soar_sc_core-0.1.15 lib/web/renderer.rb
soar_sc_core-0.1.14 lib/web/renderer.rb
soar_sc_core-0.1.13 lib/web/renderer.rb
soar_sc_core-0.1.12 lib/web/renderer.rb
soar_sc_core-0.1.11 lib/web/renderer.rb