Class: Terastream::Connection
- Inherits:
-
Object
- Object
- Terastream::Connection
- Defined in:
- lib/terastream/connection.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
- #connection ⇒ Object
- #create_statement ⇒ Object
- #hostname=(hostname) ⇒ Object
-
#initialize(options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #password=(password) ⇒ Object
- #query(query_string) ⇒ Object
- #timeout=(timeout) ⇒ Object
-
#username=(username) ⇒ Object
Config helpers.
Constructor Details
#initialize(options = {}) ⇒ Connection
Returns a new instance of Connection.
7 8 9 10 11 12 |
# File 'lib/terastream/connection.rb', line 7 def initialize( = {}) @config = Config.new() @connection = nil @formatter = Terastream::Query::RecordsBuilder.new @output = nil end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/terastream/connection.rb', line 5 def config @config end |
#formatter ⇒ Object
Returns the value of attribute formatter.
3 4 5 |
# File 'lib/terastream/connection.rb', line 3 def formatter @formatter end |
#output ⇒ Object
Returns the value of attribute output.
3 4 5 |
# File 'lib/terastream/connection.rb', line 3 def output @output end |
Instance Method Details
#connection ⇒ Object
14 15 16 |
# File 'lib/terastream/connection.rb', line 14 def connection @connection ||= get_connection end |
#create_statement ⇒ Object
18 19 20 |
# File 'lib/terastream/connection.rb', line 18 def create_statement connection.create_statement end |
#hostname=(hostname) ⇒ Object
35 36 37 |
# File 'lib/terastream/connection.rb', line 35 def hostname=(hostname) config.hostname = hostname end |
#password=(password) ⇒ Object
31 32 33 |
# File 'lib/terastream/connection.rb', line 31 def password=(password) config.password = password end |
#query(query_string) ⇒ Object
22 23 24 |
# File 'lib/terastream/connection.rb', line 22 def query(query_string) Query.build(self).execute(query_string) end |
#timeout=(timeout) ⇒ Object
39 40 41 |
# File 'lib/terastream/connection.rb', line 39 def timeout=(timeout) config.timeout = timeout end |
#username=(username) ⇒ Object
Config helpers
27 28 29 |
# File 'lib/terastream/connection.rb', line 27 def username=(username) config.username = username end |