Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/template/css/blueprint/lib/blueprint/core_ext.rb
Instance Method Summary collapse
-
#blank? ⇒ Boolean
see if string has any content.
-
#strip_selector_space! ⇒ Object
remove newlines, insert space after comma, replace two spaces with one space after comma.
-
#strip_side_space! ⇒ Object
remove leading whitespace, remove end whitespace.
-
#strip_space! ⇒ Object
strip space after :, remove newlines, replace multiple spaces with only one space, remove comments.
Instance Method Details
#blank? ⇒ Boolean
see if string has any content
3 |
# File 'lib/template/css/blueprint/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/template/css/blueprint/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/template/css/blueprint/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/template/css/blueprint/lib/blueprint/core_ext.rb', line 6 def strip_space! replace self.gsub(/:\s*/, ":").gsub(/\n/, "").gsub(/\s+/, " ").gsub(/(\/\*).*?(\*\/)/, "") end |