Sha256: 1d4a443033748248118dae18ef39a7cb84529794a1ec8e441d09a0c65dcf8006
Contents?: true
Size: 703 Bytes
Versions: 68
Compression:
Stored size: 703 Bytes
Contents
# Example usage: # # $ echo gem 'ruby2js', require: 'ruby2js/rails' > Gemfile # $ bundle update # $ rails generate controller Say hello # $ echo 'alert "Hello world!"' > app/views/say/hello.js.rb # $ rails server # $ curl http://localhost:3000/say/hello.js # # Using an optional filter: # # $ echo 'require "ruby2js/filter/functions"' > config/initializers/ruby2js.rb require 'ruby2js' module Ruby2JS module Rails class Template cattr_accessor :default_format self.default_format = Mime::JS def self.call(template) "Ruby2JS.convert(#{template.source.inspect})" end end ActionView::Template.register_template_handler :rb, Template end end
Version data entries
68 entries across 68 versions & 1 rubygems