Class: Kanrisuru::Remote::Env
- Inherits:
-
Object
- Object
- Kanrisuru::Remote::Env
- Defined in:
- lib/kanrisuru/remote/env.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #clear ⇒ Object
- #count ⇒ Object
- #delete(key) ⇒ Object
-
#initialize ⇒ Env
constructor
A new instance of Env.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Env
Returns a new instance of Env.
6 7 8 |
# File 'lib/kanrisuru/remote/env.rb', line 6 def initialize @env = {} end |
Instance Method Details
#[](key) ⇒ Object
36 37 38 |
# File 'lib/kanrisuru/remote/env.rb', line 36 def [](key) @env[key.to_s.upcase] end |
#[]=(key, value) ⇒ Object
40 41 42 |
# File 'lib/kanrisuru/remote/env.rb', line 40 def []=(key, value) @env[key.to_s.upcase] = value end |
#clear ⇒ Object
14 15 16 |
# File 'lib/kanrisuru/remote/env.rb', line 14 def clear @env = {} end |
#count ⇒ Object
28 29 30 |
# File 'lib/kanrisuru/remote/env.rb', line 28 def count @env.count end |
#delete(key) ⇒ Object
32 33 34 |
# File 'lib/kanrisuru/remote/env.rb', line 32 def delete(key) @env.delete(key.to_s.upcase) end |
#to_h ⇒ Object
10 11 12 |
# File 'lib/kanrisuru/remote/env.rb', line 10 def to_h @env end |
#to_s ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/kanrisuru/remote/env.rb', line 18 def to_s string = '' @env.each.with_index do |(key, value), index| string += "export #{key}=#{value};" string += ' ' if index < @env.length - 1 end string end |