Class: Tilt::StylusTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/stylus/tilt.rb

Overview

stylus template implementation for ‘Tilt`.

It can be used by the ‘Rails` 3.1 or `Sinatra` applications.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/stylus/tilt.rb', line 10

def self.engine_initialized?
  defined? ::Stylus
end

Instance Method Details

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



24
25
26
# File 'lib/stylus/tilt.rb', line 24

def evaluate(scope, locals, &block)
  @output ||= Stylus.compile(data, options)
end

#initialize_engineObject



14
15
16
# File 'lib/stylus/tilt.rb', line 14

def initialize_engine
  require_template_library 'stylus'
end

#prepareObject



18
19
20
21
22
# File 'lib/stylus/tilt.rb', line 18

def prepare
  if self.file
    options[:filename] ||= self.file
  end
end