# File lib/less/engine.rb, line 15 def initialize obj, options = {} @less = if obj.is_a? File @path = File.dirname File.expand_path(obj.path) obj.read elsif obj.is_a? String obj.dup else raise ArgumentError, "argument must be an instance of File or String!" end @options = options @parser = StyleSheetParser.new end
# File lib/less/engine.rb, line 29 def parse build = true, env = Node::Element.new root = @parser.parse(self.prepare) return root unless build if root @tree = root.build env.tap {|e| e.file = @path } else raise SyntaxError, @parser.failure_message(@options[:color]) end @tree end
# File lib/less/engine.rb, line 48 def prepare @less.gsub(/\r\n/, "\n").gsub(/\t/, ' ') end
Generated with the Darkfish Rdoc Generator 2.