Class: Mode::Connector::DataSource
- Inherits:
-
Object
- Object
- Mode::Connector::DataSource
- Defined in:
- lib/mode/connector/data_source.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#props ⇒ Object
readonly
Returns the value of attribute props.
Instance Method Summary collapse
- #adapter ⇒ Object
- #database ⇒ Object
- #host ⇒ Object
-
#initialize(name, props = {}) ⇒ DataSource
constructor
A new instance of DataSource.
- #password ⇒ Object
- #redshift? ⇒ Boolean
- #select(query, &block) ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(name, props = {}) ⇒ DataSource
Returns a new instance of DataSource.
12 13 14 15 |
# File 'lib/mode/connector/data_source.rb', line 12 def initialize(name, props = {}) @name = name @props = props end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
10 11 12 |
# File 'lib/mode/connector/data_source.rb', line 10 def connection @connection end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/mode/connector/data_source.rb', line 7 def name @name end |
#props ⇒ Object (readonly)
Returns the value of attribute props.
8 9 10 |
# File 'lib/mode/connector/data_source.rb', line 8 def props @props end |
Instance Method Details
#adapter ⇒ Object
17 18 19 |
# File 'lib/mode/connector/data_source.rb', line 17 def adapter props['adapter'] end |
#database ⇒ Object
33 34 35 |
# File 'lib/mode/connector/data_source.rb', line 33 def database props['database'] end |
#host ⇒ Object
29 30 31 |
# File 'lib/mode/connector/data_source.rb', line 29 def host props['host'] end |
#password ⇒ Object
25 26 27 |
# File 'lib/mode/connector/data_source.rb', line 25 def password props['password'] end |
#redshift? ⇒ Boolean
52 53 54 |
# File 'lib/mode/connector/data_source.rb', line 52 def redshift? adapter == 'redshift' end |
#select(query, &block) ⇒ Object
37 38 39 |
# File 'lib/mode/connector/data_source.rb', line 37 def select(query, &block) connection_dataset(query).each(&block) end |
#username ⇒ Object
21 22 23 |
# File 'lib/mode/connector/data_source.rb', line 21 def username props['username'] end |