Sha256: 7c86bb135c8d1240f3494a9ed7b84086d161ae52ecde7e9859b3ac10e02cddef

Contents?: true

Size: 469 Bytes

Versions: 7

Compression:

Stored size: 469 Bytes

Contents

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

  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
end

def File.binary? name
  open name do |f|
    while (b=f.read(256)) do
      return true if b[ "\0"]
    end
  end
  false
end

class Pathname
  def binary?
    File.binary?(@path)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
howl-0.6.0 lib/howl/core_ext.rb
howl-0.5.5 lib/howl/core_ext.rb
howl-0.5.4 lib/howl/core_ext.rb
howl-0.5.3 lib/howl/core_ext.rb
howl-0.5.2 lib/howl/core_ext.rb
howl-0.5.1 lib/howl/core_ext.rb
howl-0.5.0 lib/howl/core_ext.rb