Sha256: 0d08f7afec2f99d12779d25bd3f697da5f90674076cd45104837a4dbbc928edf

Contents?: true

Size: 415 Bytes

Versions: 2

Compression:

Stored size: 415 Bytes

Contents

module MslinnUtil
  # @return Path to symlink
  def self.deref_symlink(symlink)
    require 'pathname'
    Pathname.new(symlink).realpath
  end

  def self.ensure_ends_with(string, suffix)
    string = string.delete_suffix suffix
    "#{string}#{suffix}"
  end

  def self.expand_env(str)
    str.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}|%\g<1>%/) do
      ENV.fetch(Regexp.last_match(1), nil)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git_tree-0.2.1 lib/util.rb
git_tree-0.2.0 lib/util.rb