Class: CassandraModel::Config
Constant Summary collapse
- @@cfg_file =
nil
- @@hosts =
['127.0.0.1:9160']
- @@username =
nil
- @@password =
nil
- @@keyspace =
nil
Class Method Summary collapse
- .cfg_file ⇒ Object
- .cfg_file=(file) ⇒ Object
- .hosts ⇒ Object
- .hosts=(hosts) ⇒ Object
- .init ⇒ Object
- .initialize_props(props) ⇒ Object
- .keyspace ⇒ Object
- .keyspace=(keyspace) ⇒ Object
- .password ⇒ Object
- .password=(password) ⇒ Object
- .username ⇒ Object
- .username=(username) ⇒ Object
Class Method Details
.cfg_file ⇒ Object
15 16 17 |
# File 'lib/cassandra-model/config.rb', line 15 def self.cfg_file @@cfg_file ||= File.join(Rails.root,'config','cassandra_conf.yml') end |
.cfg_file=(file) ⇒ Object
19 20 21 |
# File 'lib/cassandra-model/config.rb', line 19 def self.cfg_file=(file) @@cfg_file = file end |
.hosts ⇒ Object
23 24 25 |
# File 'lib/cassandra-model/config.rb', line 23 def self.hosts @@hosts end |
.hosts=(hosts) ⇒ Object
27 28 29 |
# File 'lib/cassandra-model/config.rb', line 27 def self.hosts=(hosts) @@hosts = hosts end |
.init ⇒ Object
55 56 57 58 |
# File 'lib/cassandra-model/config.rb', line 55 def self.init cfg = YAML.load_file(self.cfg_file)[::Rails.env] initialize_props cfg end |
.initialize_props(props) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/cassandra-model/config.rb', line 60 def self.initialize_props props self.hosts = props['hosts'] self.username = props['username'] self.password = props['password'] self.keyspace = props['keyspace'] end |
.keyspace ⇒ Object
47 48 49 |
# File 'lib/cassandra-model/config.rb', line 47 def self.keyspace @@keyspace end |
.keyspace=(keyspace) ⇒ Object
51 52 53 |
# File 'lib/cassandra-model/config.rb', line 51 def self.keyspace=(keyspace) @@keyspace = keyspace end |
.password ⇒ Object
39 40 41 |
# File 'lib/cassandra-model/config.rb', line 39 def self.password @@password end |
.password=(password) ⇒ Object
43 44 45 |
# File 'lib/cassandra-model/config.rb', line 43 def self.password=(password) @@password = password end |
.username ⇒ Object
31 32 33 |
# File 'lib/cassandra-model/config.rb', line 31 def self.username @@username end |
.username=(username) ⇒ Object
35 36 37 |
# File 'lib/cassandra-model/config.rb', line 35 def self.username=(username) @@username = username end |