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-3.0.3 lib/web/renderer.rb
soar_sc_core-3.0.2 lib/web/renderer.rb
soar_sc_core-3.0.1 lib/web/renderer.rb
soar_sc_core-3.0.0 lib/web/renderer.rb
soar_sc_core-2.0.0 lib/web/renderer.rb
soar_sc_core-1.7.2 lib/web/renderer.rb
soar_sc_core-1.7.1 lib/web/renderer.rb
soar_sc_core-1.7.0 lib/web/renderer.rb
soar_sc_core-1.6.1 lib/web/renderer.rb
soar_sc_core-1.6.0 lib/web/renderer.rb
soar_sc_core-1.5.0 lib/web/renderer.rb
soar_sc_core-1.4.1 lib/web/renderer.rb
soar_sc_core-1.4.0 lib/web/renderer.rb
soar_sc_core-1.3.1 lib/web/renderer.rb
soar_sc_core-1.3.0 lib/web/renderer.rb
soar_sc_core-1.2.11 lib/web/renderer.rb
soar_sc_core-1.2.10 lib/web/renderer.rb
soar_sc_core-1.2.9 lib/web/renderer.rb
soar_sc_core-1.2.8 lib/web/renderer.rb
soar_sc_core-1.2.7 lib/web/renderer.rb