Class: String

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

Instance Method Summary collapse

Instance Method Details

#drop(num) ⇒ Object



2
3
4
# File 'lib/howl/core_ext.rb', line 2

def drop(num)
  self.dup.split(//).drop(num).join
end

#slugifyObject



6
7
8
9
10
11
# File 'lib/howl/core_ext.rb', line 6

def slugify
  string = self.dup
  string.gsub!(/[^\x00-\x7F]+/, '')     # Remove anything non-ASCII entirely (e.g. diacritics).
  string.gsub!(/[^a-z0-9\-_]+/i, '-')
  string.downcase
end