Class: Ath::Shell
- Inherits:
-
Object
- Object
- Ath::Shell
- Defined in:
- lib/ath/shell.rb
Constant Summary collapse
- HISTORY_FILE =
File.join(ENV.fetch('HOME', '.'), '.ath_history')
- HISTSIZE =
1000
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#pager ⇒ Object
Returns the value of attribute pager.
Instance Method Summary collapse
-
#initialize(athena: Aws::Athena::Client.new, s3: Aws::S3::Client.new, output_location:, database: nil, pager: nil, options: {}) ⇒ Shell
constructor
A new instance of Shell.
- #oneshot(query) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(athena: Aws::Athena::Client.new, s3: Aws::S3::Client.new, output_location:, database: nil, pager: nil, options: {}) ⇒ Shell
Returns a new instance of Shell.
9 10 11 12 13 14 |
# File 'lib/ath/shell.rb', line 9 def initialize(athena: Aws::Athena::Client.new, s3: Aws::S3::Client.new, output_location:, database: nil, pager: nil, options: {}) @driver = Ath::Driver.new(athena: athena, s3: s3, output_location: output_location, database: database, options: ) @pager = pager @options = @scanner = Ath::Scanner.new(shell: self) end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
5 6 7 |
# File 'lib/ath/shell.rb', line 5 def driver @driver end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/ath/shell.rb', line 6 def @options end |
#pager ⇒ Object
Returns the value of attribute pager.
7 8 9 |
# File 'lib/ath/shell.rb', line 7 def pager @pager end |
Instance Method Details
#oneshot(query) ⇒ Object
26 27 28 |
# File 'lib/ath/shell.rb', line 26 def oneshot(query) execute_query(query) end |
#start ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/ath/shell.rb', line 16 def start load_history while line = Readline.readline(prompt, true) execute_query(line) end ensure save_history end |