Sha256: b59c527731c6152a09ad15ffb28aa45696b94c1188ada3e00df34bcb72513334

Contents?: true

Size: 483 Bytes

Versions: 5

Compression:

Stored size: 483 Bytes

Contents

module Tay
  ##
  # Simple helpers used across various classes
  class Utils
    ##
    # Convert an extension name to a filesystem friendly name
    def self.filesystem_name(name)
      name.gsub(/[^a-zA-Z0-9\-_ ]/, '').gsub(/ /, '_').downcase
    end

    ##
    # Convert a path to be relative to pwd
    def self.relative_path_to(path)
      if path.is_a?(String)
        path = Pathname.new(path)
      end
      path.relative_path_from(Pathname.new(Dir.pwd))
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tay-0.1.0 lib/tay/utils.rb
tay-0.0.5 lib/tay/utils.rb
tay-0.0.4 lib/tay/utils.rb
tay-0.0.3 lib/tay/utils.rb
tay-0.0.2 lib/tay/utils.rb