Sha256: 6e8ed238c399f532989f5fc84148a137eb7a589c0768567dcf8f50898421d908

Contents?: true

Size: 388 Bytes

Versions: 4

Compression:

Stored size: 388 Bytes

Contents

# -*- coding: utf-8 -*-
# vim:ft=ruby:enc=utf-8

module ToPass::Converters
  # replace the string "USER" with the current username
  class Userize
    def self.convert(string) # :nodoc:
      username = if `which whoami`
                   `whoami`.chomp
                 else
                   "thecurrentuser"
                 end

      string.gsub("USER",username)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
to_pass-0.6.0 test/fixtures/user_converter.rb
to_pass-0.5.2 test/fixtures/user_converter.rb
to_pass-0.5.0 test/fixtures/user_converter.rb
to_pass-0.4.0 test/fixtures/user_converter.rb