Class: Ractive::Rails::Tilt

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/ractive/rails/tilt.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



5
6
7
# File 'lib/ractive/rails/tilt.rb', line 5

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



13
14
15
16
17
18
# File 'lib/ractive/rails/tilt.rb', line 13

def evaluate(scope, locals, &block)
  <<-TEMPLATE
    this.RactiveTemplates || (this.RactiveTemplates = {});
    this.RactiveTemplates['#{scope.logical_path}'] = #{Ractive.parse(data).to_json};
  TEMPLATE
end

#prepareObject



9
10
11
# File 'lib/ractive/rails/tilt.rb', line 9

def prepare

end