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