Sha256: 39472ae65035cbbe9d71cabdf12ed5c760cd87282d06149753bc88abda743cba

Contents?: true

Size: 378 Bytes

Versions: 14

Compression:

Stored size: 378 Bytes

Contents

class String
  # Converts string to something suitable to be used as an element id
  def slugify
    self.strip.gsub(/\W|_/, '-').gsub(/\s|^_*|_*$/, '').squeeze('-')
  end
end

module Enumerable
  # Like a normal collect, only with index
  def collect_with_index
    result = []
    self.each_with_index do |elt, idx|
      result << yield(elt, idx)
    end
    result
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.12.11 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.10 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.9 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.8 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.7 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.6 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.5 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.4 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.3 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.2 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.1 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.12.0 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.11.2 lib/comfortable_mexican_sofa/extensions/rails.rb
comfortable_mexican_sofa-1.11.1 lib/comfortable_mexican_sofa/extensions/rails.rb