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-1.2.6 lib/web/renderer.rb
soar_sc_core-1.2.5 lib/web/renderer.rb
soar_sc_core-1.2.4 lib/web/renderer.rb
soar_sc_core-1.2.3 lib/web/renderer.rb
soar_sc_core-1.2.2 lib/web/renderer.rb
soar_sc_core-1.2.1 lib/web/renderer.rb
soar_sc_core-1.2.0 lib/web/renderer.rb
soar_sc_core-1.1.4 lib/web/renderer.rb
soar_sc_core-1.1.3 lib/web/renderer.rb
soar_sc_core-1.1.2 lib/web/renderer.rb
soar_sc_core-1.1.1 lib/web/renderer.rb
soar_sc_core-1.1.0 lib/web/renderer.rb
soar_sc_core-1.0.1 lib/web/renderer.rb
soar_sc_core-1.0.0 lib/web/renderer.rb
soar_sc_core-0.11.1 lib/web/renderer.rb
soar_sc_core-0.11.1.rc2 lib/web/renderer.rb
soar_sc_core-0.11.1.rc1 lib/web/renderer.rb
soar_sc_core-0.11.0 lib/web/renderer.rb
soar_sc_core-0.10.0 lib/web/renderer.rb
soar_sc_core-0.9.0 lib/web/renderer.rb