Sha256: d2e0118ed41fe55b775bcdc04f054f11988c490f88d99ee528e1f384e809b4b5
Contents?: true
Size: 957 Bytes
Versions: 6
Compression:
Stored size: 957 Bytes
Contents
# frozen_string_literal: true # encoding=utf-8 # utility functions to read environment variables # module Env # :reek:BooleanParameter # :reek:DataClump # :reek:NilCheck # :reek:UtilityFunction def env_bool(name, default: false) return default if name.nil? || (val = ENV.fetch(name, nil)).nil? return false if val.empty? || val == '0' true end # :reek:UtilityFunction def env_bool_false(name) !(val = name && ENV.fetch(name, nil)).nil? && !(val.empty? || val == '0') end # skip :reek:DataClump # skip :reek:NilCheck # skip :reek:UtilityFunction def env_int(name, default: 0) return default if name.nil? || (val = ENV.fetch(name, nil)).nil? return default if val.empty? val.to_i end # skip :reek:DataClump # skip :reek:NilCheck # skip :reek:UtilityFunction def env_str(name, default: '') return default if name.nil? || (val = ENV.fetch(name, nil)).nil? val || default end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
markdown_exec-2.7.2 | lib/env.rb |
markdown_exec-2.7.1 | lib/env.rb |
markdown_exec-2.7.0 | lib/env.rb |
markdown_exec-2.6.0 | lib/env.rb |
markdown_exec-2.5.0 | lib/env.rb |
markdown_exec-2.4.0 | lib/env.rb |