Class: JetBlack::Session
- Inherits:
-
Object
- Object
- JetBlack::Session
- Extended by:
- Forwardable
- Defined in:
- lib/jet_black/session.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
Instance Method Summary collapse
-
#initialize(options: {}) ⇒ Session
constructor
A new instance of Session.
- #run(command, stdin: nil, env: {}, options: {}) ⇒ Object
Constructor Details
#initialize(options: {}) ⇒ Session
Returns a new instance of Session.
21 22 23 24 25 26 |
# File 'lib/jet_black/session.rb', line 21 def initialize(options: {}) @commands = [] @session_options = @directory = File.realpath(Dir.mktmpdir("jet_black")) @file_helper = FileHelper.new(directory) end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
19 20 21 |
# File 'lib/jet_black/session.rb', line 19 def commands @commands end |
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
19 20 21 |
# File 'lib/jet_black/session.rb', line 19 def directory @directory end |
Instance Method Details
#run(command, stdin: nil, env: {}, options: {}) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/jet_black/session.rb', line 28 def run(command, stdin: nil, env: {}, options: {}) = .merge() executed_command = exec_command(command, stdin, env, ) commands << executed_command executed_command end |