Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/blueprint/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

see if string has any content


3
# File 'lib/blueprint/core_ext.rb', line 3

def blank?; self.length.zero?; end

#strip_selector_space!Object

remove newlines, insert space after comma, replace two spaces with one space after comma


11
12
13
# File 'lib/blueprint/core_ext.rb', line 11

def strip_selector_space!
  replace self.gsub(/\n/, "").gsub(",", ", ").gsub(",  ", ", ")
end

#strip_side_space!Object

remove leading whitespace, remove end whitespace


16
17
18
# File 'lib/blueprint/core_ext.rb', line 16

def strip_side_space!
  replace self.gsub(/^\s+/, "").gsub(/\s+$/, $/)
end

#strip_space!Object

strip space after :, remove newlines, replace multiple spaces with only one space, remove comments


6
7
8
# File 'lib/blueprint/core_ext.rb', line 6

def strip_space!
  replace self.gsub(/:\s*/, ":").gsub(/\n/, "").gsub(/\s+/, " ").gsub(/(\/\*).*?(\*\/)/, "")
end