Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/gidget/ext.rb
Instance Method Summary collapse
Instance Method Details
#slugize ⇒ Object
2 3 4 |
# File 'lib/gidget/ext.rb', line 2 def slugize self.downcase.gsub(/&/, 'and').gsub(/\s+/, '-').gsub(/[^a-z0-9-]/, '') end |
#starts_with?(prefix) ⇒ Boolean
7 8 9 10 |
# File 'lib/gidget/ext.rb', line 7 def starts_with?(prefix) prefix = prefix.to_s self[0, prefix.length] == prefix end |