Class: Tilt::StylusTemplate
- Inherits:
-
Template
- Object
- Template
- Tilt::StylusTemplate
- Defined in:
- lib/stylus/tilt/stylus.rb
Direct Known Subclasses
Class Method Summary collapse
-
.engine_initialized? ⇒ Boolean
Internal: Checks if the Stylus module has been properly defined.
Instance Method Summary collapse
-
#evaluate(scope, locals, &block) ⇒ Object
Internal: Compile the template Stylus using this instance options.
-
#initialize_engine ⇒ Object
Internal: Require the ‘stylus’ file to load the Stylus module.
-
#prepare ⇒ Object
Internal: Caches the filename as an option entry if it’s present.
Class Method Details
.engine_initialized? ⇒ Boolean
Internal: Checks if the Stylus module has been properly defined.
Returns true if the ‘Stylus’ module is present.
21 22 23 |
# File 'lib/stylus/tilt/stylus.rb', line 21 def self.engine_initialized? defined? ::Stylus end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
Internal: Compile the template Stylus using this instance options. The current ‘scope’ and given ‘locals’ are ignored and the output is cached.
Returns a String with the compiled stylesheet with CSS syntax.
46 47 48 |
# File 'lib/stylus/tilt/stylus.rb', line 46 def evaluate(scope, locals, &block) @output ||= Stylus.compile(data, ) end |
#initialize_engine ⇒ Object
Internal: Require the ‘stylus’ file to load the Stylus module.
Returns nothing.
28 29 30 |
# File 'lib/stylus/tilt/stylus.rb', line 28 def initialize_engine require_template_library 'stylus' end |
#prepare ⇒ Object
Internal: Caches the filename as an option entry if it’s present.
Returns nothing.
35 36 37 38 39 |
# File 'lib/stylus/tilt/stylus.rb', line 35 def prepare if self.file [:filename] ||= self.file end end |