module Sass::Shared
def balance(scanner, start, finish, count = 0)
- 
        
((String, String))- The string matched within the balanced pair 
Parameters:
- 
        
count(Fixnum) -- The number of opening characters matched - 
        
finish(Character) -- The character closing the balanced pair. - 
        
start(Character) -- The character opening the balanced pair. - 
        
scanner(StringScanner) -- The string scanner to move 
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) while scanner.scan(regexp) str << scanner.matched count += 1 if scanner.matched[-1] == start count -= 1 if scanner.matched[-1] == finish return [str.strip, scanner.rest] if count == 0 end end
def handle_interpolation(str)
- 
        
(String)- The text remaining in the scanner after all `#{`s have been processed 
Other tags:
- Yieldparam:  scan -  The scanner scanning through the string 
 
def handle_interpolation(str) scan = StringScanner.new(str) yield scan while scan.scan(/(.*?)(\\*)\#\{/) scan.rest end
def human_indentation(indentation, was = false)
- 
        
(String)- The name of the indentation (e.g. `"12 spaces"`, `"1 tab"`) 
Parameters:
- 
        
was(Boolean) -- Whether or not to add `"was"` or `"were"` - 
        
indentation(String) -- The string used for indentation 
def human_indentation(indentation, was = false) if !indentation.include?(?\t) noun = 'space' elsif !indentation.include?(?\s) noun = 'tab' else return indentation.inspect + (was ? ' was' : '') end singular = indentation.length == 1 if was was = singular ? ' was' : ' were' else was = '' end "#{indentation.length} #{noun}#{'s' unless singular}#{was}" end