Class: Juici::BuildEnvironment
- Inherits:
-
Object
- Object
- Juici::BuildEnvironment
- Defined in:
- lib/juici/build_environment.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #[](k) ⇒ Object
-
#initialize ⇒ BuildEnvironment
constructor
A new instance of BuildEnvironment.
-
#load_json!(json) ⇒ Object
XXX This is spectacular.
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ BuildEnvironment
Returns a new instance of BuildEnvironment.
6 7 8 9 10 11 12 13 |
# File 'lib/juici/build_environment.rb', line 6 def initialize @env = ENV.to_hash.tap do |env| BUILD_SENSITIVE_VARIABLES.each do |var| env[var] = nil end env["BUNDLE_CONFIG"] = "/nonexistent" end end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/juici/build_environment.rb', line 5 def env @env end |
Instance Method Details
#[](k) ⇒ Object
15 16 17 |
# File 'lib/juici/build_environment.rb', line 15 def [](k) env[k] end |
#load_json!(json) ⇒ Object
XXX This is spectacular. Not in the good way
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/juici/build_environment.rb', line 21 def load_json!(json) return true if json == "" loaded_json = JSON.load(json) if loaded_json.is_a? Hash env.merge!(loaded_json) return true end false rescue JSON::ParserError return false end |
#to_hash ⇒ Object
33 34 35 |
# File 'lib/juici/build_environment.rb', line 33 def to_hash env end |