Class: Dtf::Session::Environment
- Inherits:
-
Object
- Object
- Dtf::Session::Environment
- Defined in:
- lib/dtf-session.rb
Instance Attribute Summary collapse
-
#start_env ⇒ Object
Returns the value of attribute start_env.
-
#stop_env ⇒ Object
Returns the value of attribute stop_env.
-
#test_shell ⇒ Object
Returns the value of attribute test_shell.
Instance Method Summary collapse
Instance Attribute Details
#start_env ⇒ Object
Returns the value of attribute start_env.
17 18 19 |
# File 'lib/dtf-session.rb', line 17 def start_env @start_env end |
#stop_env ⇒ Object
Returns the value of attribute stop_env.
18 19 20 |
# File 'lib/dtf-session.rb', line 18 def stop_env @stop_env end |
#test_shell ⇒ Object
Returns the value of attribute test_shell.
16 17 18 |
# File 'lib/dtf-session.rb', line 16 def test_shell @test_shell end |
Instance Method Details
#env_to_hash(env_string) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/dtf-session.rb', line 30 def env_to_hash(env_string) lines = env_string.split("\n") key_value_pairs = lines.map { |line| key, value = *line.split("=", 2) [key.to_sym, value] } Hash[key_value_pairs] end |
#set_start_env(shell) ⇒ Object
20 21 22 23 |
# File 'lib/dtf-session.rb', line 20 def set_start_env(shell) env = shell.execute('printenv') @start_env = self.env_to_hash(env[0]) end |
#set_stop_env(shell) ⇒ Object
25 26 27 28 |
# File 'lib/dtf-session.rb', line 25 def set_stop_env(shell) env = shell.execute('printenv') @stop_env = self.env_to_hash(env[0]) end |