Class: Terastream::CLI
- Inherits:
-
Object
- Object
- Terastream::CLI
- Defined in:
- lib/terastream/cli.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#file ⇒ Object
Returns the value of attribute file.
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#output ⇒ Object
Returns the value of attribute output.
-
#output_options ⇒ Object
Returns the value of attribute output_options.
-
#password ⇒ Object
Returns the value of attribute password.
-
#query ⇒ Object
Returns the value of attribute query.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #config_options ⇒ Object
- #formatter_object ⇒ Object
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #missing_hostname? ⇒ Boolean
- #missing_query? ⇒ Boolean
- #output_object ⇒ Object
- #query_string ⇒ Object
Constructor Details
#initialize ⇒ CLI
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/terastream/cli.rb', line 16 def initialize @config = nil @file = nil @formatter = "json" @hostname = nil @output = nil @password = nil @query = nil @timeout = 10000 @username = nil @output_options = {} end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def config @config end |
#file ⇒ Object
Returns the value of attribute file.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def file @file end |
#formatter ⇒ Object
Returns the value of attribute formatter.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def formatter @formatter end |
#hostname ⇒ Object
Returns the value of attribute hostname.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def hostname @hostname end |
#output ⇒ Object
Returns the value of attribute output.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def output @output end |
#output_options ⇒ Object
Returns the value of attribute output_options.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def @output_options end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def password @password end |
#query ⇒ Object
Returns the value of attribute query.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def query @query end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def timeout @timeout end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/terastream/cli.rb', line 5 def username @username end |
Instance Method Details
#config_options ⇒ Object
33 34 35 |
# File 'lib/terastream/cli.rb', line 33 def @_config ||= read_config_file end |
#formatter_object ⇒ Object
45 46 47 |
# File 'lib/terastream/cli.rb', line 45 def formatter_object formatter == "csv" ? Terastream::CSVBuilder.new : Terastream::JsonBuilder.new end |
#missing_hostname? ⇒ Boolean
41 42 43 |
# File 'lib/terastream/cli.rb', line 41 def missing_hostname? hostname.nil? end |
#missing_query? ⇒ Boolean
37 38 39 |
# File 'lib/terastream/cli.rb', line 37 def missing_query? query_string.nil? end |
#output_object ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/terastream/cli.rb', line 49 def output_object case (output || "").to_sym when :redis Terastream::Output::Redis.new(config_for("redis")) when :kinesis when :kafka Terastream::Output::Kakfa.new(config_for("kafka")) else nil end end |
#query_string ⇒ Object
29 30 31 |
# File 'lib/terastream/cli.rb', line 29 def query_string @_query_string ||= build_query_string end |