cassandra_record 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15e9b62adf2878cd1519843016be084e20ae05c2
4
- data.tar.gz: e0f60d8679f48770283c0d9d2af5e9865a9361c0
3
+ metadata.gz: fe208c6485141f647ff8426b3b7860ba61ee645b
4
+ data.tar.gz: 706fe6436935740b5e1acc4c444e204e61f09779
5
5
  SHA512:
6
- metadata.gz: f71feade39ab085b9ba0cfd24c1b5e4dae26e03299c31e5496445900edecbda81777932438ce1921c97423853d7c8910f7a731b163a9f362350364c3e286e423
7
- data.tar.gz: b1a53502f6027829f06361841d72b91e8d7297e0fed04c0229d997fda862beb7e2faec39f6d71fd62084b545168bd6fa5e777a8e92709f42a9c260ea02893c37
6
+ metadata.gz: 672cfd4382436838ce23d5f68baec903e9c0e743981f8b1aa87c133a29657140db4df3d157f30032a491c6ec3cfc70c1a2bc88610f979577db8f8d226a68e362
7
+ data.tar.gz: 0540be113f7a1536a5c1877e2032b9aa543262b93d859a5375004553e128277147edb23c005aadc1572761498849728479ad45aae75ab95ec82dee97977cb306
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cassandra_record (0.0.1)
4
+ cassandra_record (0.0.3)
5
5
  activesupport
6
6
  cassandra-driver
7
7
 
@@ -9,10 +9,6 @@ module CassandraRecord
9
9
 
10
10
  attr_reader :keyspace
11
11
 
12
- def session
13
- @session ||= ::Cassandra.cluster.connect(@keyspace)
14
- end
15
-
16
12
  def use(keyspace_name)
17
13
  @session = nil
18
14
  @keyspace = keyspace_name
@@ -27,11 +23,26 @@ module CassandraRecord
27
23
  end
28
24
 
29
25
  def cluster
30
- ::Cassandra.cluster.connect
26
+ cluster_connection.connect
31
27
  end
32
28
 
33
29
  def session
34
- @session ||= ::Cassandra.cluster.connect(@keyspace)
30
+ @session ||= cluster_connection.connect(@keyspace)
31
+ end
32
+
33
+ def configuration(&block)
34
+ yield(connection_configuration) if block_given?
35
+ connection_configuration
36
+ end
37
+
38
+ private
39
+
40
+ def cluster_connection
41
+ ::Cassandra.cluster(connection_configuration)
42
+ end
43
+
44
+ def connection_configuration
45
+ @connection_configuration ||= {}
35
46
  end
36
47
 
37
48
  end
@@ -1,3 +1,3 @@
1
1
  module CassandraRecord
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe CassandraRecord::Database::Adapters::Cassandra do
4
+ subject(:adapter) { CassandraRecord::Database::Adapters::Cassandra.instance }
5
+
6
+ describe "#configuration" do
7
+ before do
8
+ adapter.configuration do |config|
9
+ config[:thing] = 'stuff'
10
+ config[:other_thing] = 'other_stuff'
11
+ end
12
+ end
13
+
14
+ specify { expect(adapter.configuration[:thing]).to eq('stuff') }
15
+ specify { expect(adapter.configuration[:other_thing]).to eq('other_stuff') }
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gust
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,7 @@ files:
87
87
  - lib/cassandra_record/version.rb
88
88
  - spec/integration/cassandra_record/base_spec.rb
89
89
  - spec/spec_helper.rb
90
+ - spec/unit/cassandra_record/database/adapters/cassandra_spec.rb
90
91
  homepage: ''
91
92
  licenses:
92
93
  - MIT
@@ -107,11 +108,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  version: '0'
108
109
  requirements: []
109
110
  rubyforge_project:
110
- rubygems_version: 2.2.0
111
+ rubygems_version: 2.2.2
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: A familiar interface to Cassandra-backed models
114
115
  test_files:
115
116
  - spec/integration/cassandra_record/base_spec.rb
116
117
  - spec/spec_helper.rb
118
+ - spec/unit/cassandra_record/database/adapters/cassandra_spec.rb
117
119
  has_rdoc: