[Haml] Use extend self for Haml::Shared.

This commit is contained in:
Nathan Weizenbaum 2009-04-30 12:52:45 -07:00
parent cc98a81c41
commit 60f9b4f37b
1 changed files with 5 additions and 3 deletions

View File

@ -4,13 +4,15 @@ require 'strscan'
module Haml
# This module contains functionality that's shared across Haml and Sass.
module Shared
def self.handle_interpolation(str)
extend self
def handle_interpolation(str)
scan = StringScanner.new(str)
yield scan while scan.scan(/(.*?)(\\*)\#\{/)
scan.rest
end
def self.balance(scanner, start, finish, count = 0)
def balance(scanner, start, finish, count = 0)
str = ''
scanner = StringScanner.new(scanner) unless scanner.is_a? StringScanner
regexp = Regexp.new("(.*?)[\\#{start.chr}\\#{finish.chr}]", Regexp::MULTILINE)
@ -22,7 +24,7 @@ module Haml
end
end
def self.human_indentation(indentation, was = false)
def human_indentation(indentation, was = false)
if !indentation.include?(?\t)
noun = 'space'
elsif !indentation.include?(?\s)