Class: Pkgr::Env
- Inherits:
-
Object
- Object
- Pkgr::Env
- Defined in:
- lib/pkgr/env.rb
Instance Attribute Summary collapse
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
-
#initialize(variables = nil) ⇒ Env
constructor
A new instance of Env.
- #merge(other) ⇒ Object
- #present? ⇒ Boolean
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(variables = nil) ⇒ Env
Returns a new instance of Env.
5 6 7 |
# File 'lib/pkgr/env.rb', line 5 def initialize(variables = nil) @variables = variables || [] end |
Instance Attribute Details
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
3 4 5 |
# File 'lib/pkgr/env.rb', line 3 def variables @variables end |
Instance Method Details
#merge(other) ⇒ Object
21 22 23 |
# File 'lib/pkgr/env.rb', line 21 def merge(other) self.class.new(self.variables + other.variables) end |
#present? ⇒ Boolean
13 14 15 |
# File 'lib/pkgr/env.rb', line 13 def present? create_env_hash_from_string.length > 0 end |
#to_hash ⇒ Object
17 18 19 |
# File 'lib/pkgr/env.rb', line 17 def to_hash create_env_hash_from_string end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/pkgr/env.rb', line 9 def to_s to_hash.map {|k, v| " #{k}=#{v}" }.join end |