Class: Coque::Context
- Inherits:
-
Object
- Object
- Coque::Context
- Defined in:
- lib/coque/context.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #[](*args) ⇒ Object
- #chdir(new_dir) ⇒ Object
- #disinherit_env ⇒ Object
- #disinherits_env? ⇒ Boolean
-
#initialize(dir = Dir.pwd, env = {}, disinherits_env = false) ⇒ Context
constructor
A new instance of Context.
- #rb(&block) ⇒ Object
- #setenv(opts) ⇒ Object
Constructor Details
#initialize(dir = Dir.pwd, env = {}, disinherits_env = false) ⇒ Context
Returns a new instance of Context.
4 5 6 7 8 |
# File 'lib/coque/context.rb', line 4 def initialize(dir = Dir.pwd, env = {}, disinherits_env = false) @dir = dir @env = env @disinherits_env = disinherits_env end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
3 4 5 |
# File 'lib/coque/context.rb', line 3 def dir @dir end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
3 4 5 |
# File 'lib/coque/context.rb', line 3 def env @env end |
Instance Method Details
#[](*args) ⇒ Object
14 15 16 |
# File 'lib/coque/context.rb', line 14 def [](*args) Sh.new(self, args) end |
#chdir(new_dir) ⇒ Object
22 23 24 |
# File 'lib/coque/context.rb', line 22 def chdir(new_dir) Context.new(new_dir, env, disinherits_env?) end |
#disinherit_env ⇒ Object
31 32 33 |
# File 'lib/coque/context.rb', line 31 def disinherit_env Context.new(dir, {}, true) end |
#disinherits_env? ⇒ Boolean
10 11 12 |
# File 'lib/coque/context.rb', line 10 def disinherits_env? @disinherits_env end |