Sha256: 5ec3459a648d7974808f3d4f27df8a22732edfaeb69e14a50e8e422a745362ff
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
# Copyright (c) 2013-2015 SUSE LLC # # This program is free software; you can redistribute it and/or # modify it under the terms of version 3 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, contact SUSE LLC. # # To contact SUSE about this file by physical or electronic mail, # you may find current contact information at www.suse.com module Machinery def self.is_int?(string) (string =~ /^\d+$/) != nil end end def with_c_locale(&block) with_env "LC_ALL" => "C", &block end def with_env(env) # ENV isn't a Hash, but a weird Hash-like object. Calling #to_hash on it # will copy its items into a newly created Hash instance. This approach # ensures that any modifications of ENV won't affect the stored value. saved_env = ENV.to_hash begin ENV.replace(saved_env.merge(env)) yield ensure ENV.replace(saved_env) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
machinery-tool-1.6.0 | lib/helper.rb |
machinery-tool-1.5.0 | lib/helper.rb |
machinery-tool-1.4.0 | lib/helper.rb |