From 3d1d0b2ec6f89d81fd0cf4320556d99e3e3b6faf Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 23 Apr 2009 16:42:37 -0700 Subject: [PATCH] [Sass] Use Tree::Node#render to shorten tree rendering. --- lib/sass/engine.rb | 2 +- lib/sass/plugin.rb | 3 +-- lib/sass/tree/node.rb | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index d28289ea..62a6871b 100644 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -105,7 +105,7 @@ module Sass # Processes the template and returns the result as a string. def render - to_tree.perform(Environment.new).to_s + to_tree.render end alias_method :to_css, :render diff --git a/lib/sass/plugin.rb b/lib/sass/plugin.rb index 717a843f..f45f8b10 100644 --- a/lib/sass/plugin.rb +++ b/lib/sass/plugin.rb @@ -71,8 +71,7 @@ module Sass filename = template_filename(name, template_location) result = begin - Sass::Files.tree_for(filename, engine_options(:css_filename => css, :filename => filename)). - perform(Environment.new).to_s + Sass::Files.tree_for(filename, engine_options(:css_filename => css, :filename => filename)).render rescue Exception => e exception_string(e) end diff --git a/lib/sass/tree/node.rb b/lib/sass/tree/node.rb index 62106422..a61a8cef 100644 --- a/lib/sass/tree/node.rb +++ b/lib/sass/tree/node.rb @@ -35,6 +35,10 @@ module Sass self.class == other.class && other.children == children end + def render + perform(Environment.new).to_s + end + def to_s result = String.new children.each do |child|