File: erb.rb

package info (click to toggle)
libinnate-ruby 2010.07-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 812 kB
  • ctags: 621
  • sloc: ruby: 4,242; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'erb'

module Innate
  module View
    module ERB
      def self.call(action, string)
        erb = View.compile(string){|str| ::ERB.new(str, nil, '%<>') }
        erb.filename = (action.view || action.method).to_s
        html = erb.result(action.binding)
        return html, Response.mime_type
      end
    end
  end
end