Class: Gojira::Deck::Base
- Inherits:
-
Object
- Object
- Gojira::Deck::Base
- Defined in:
- lib/gojira/deck/base.rb
Instance Attribute Summary collapse
-
#binary_path ⇒ Object
readonly
Returns the value of attribute binary_path.
-
#error ⇒ Object
Returns the value of attribute error.
-
#output ⇒ Object
Returns the value of attribute output.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #execute(command) ⇒ Object
-
#initialize(binary_path, kong_addr = nil, config_file = nil, timeout = 10, tls_params = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(binary_path, kong_addr = nil, config_file = nil, timeout = 10, tls_params = {}) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gojira/deck/base.rb', line 11 def initialize(binary_path, kong_addr = nil, config_file = nil, timeout = 10, tls_params = {}) @binary_path = binary_path @params = { kong_addr: kong_addr, config_file: config_file, timeout: timeout, tls_params: tls_params } @output = [] @error = [] end |
Instance Attribute Details
#binary_path ⇒ Object (readonly)
Returns the value of attribute binary_path.
8 9 10 |
# File 'lib/gojira/deck/base.rb', line 8 def binary_path @binary_path end |
#error ⇒ Object
Returns the value of attribute error.
9 10 11 |
# File 'lib/gojira/deck/base.rb', line 9 def error @error end |
#output ⇒ Object
Returns the value of attribute output.
9 10 11 |
# File 'lib/gojira/deck/base.rb', line 9 def output @output end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/gojira/deck/base.rb', line 8 def params @params end |
Instance Method Details
#execute(command) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/gojira/deck/base.rb', line 23 def execute(command) stdout_str, stderr_str, status = Open3.capture3("#{@binary_path} #{command} #{param_string}") @output << stdout_str.chomp and return if status.success? @error << "Error executing command: #{stderr_str}" end |