rom-cassandra 0.0.1 → 0.0.2

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: 95ad111834cd3031448f079dcab99f738a24793c
4
- data.tar.gz: dc679d27a628538c28031184feba42dc0a6e7c3d
3
+ metadata.gz: ee07ac6ff927d08e9285e0dc8eadb408cb4bf59d
4
+ data.tar.gz: faee7575a2d2a67546107b202aef9664123227f6
5
5
  SHA512:
6
- metadata.gz: b5ed691f588d7725506b0508d097ab441701aa0b3838fac7fae15a8011317f99932da4ab81f23e86ecf921fca314390635036464f2aeb9605655e8fa08e96798
7
- data.tar.gz: 8df90d6241f9a13e72a4781deddec0b2c91dbbe3d99b64a8ee92028eade9da221ff92b87600343d3429bec267670d1662ed880185d6ae3d411082b89c0a39a54
6
+ metadata.gz: 958319a22bf37c41d1ed6f4ec94a46223ae94d01757d1f3b2726348bdb17e9dfc6241f808df77b6b91655b72ba00ebd030fafd491afe4083717c0d80af7d0db7
7
+ data.tar.gz: 42e3eed1ec49ad63bdc34e7825e1f25e6460ffa7292a69a8c0f986d5a20f470353692d058c77e87f2275eb1692f5fddd5fb511cdb120e85598381649d879a448
@@ -1,3 +1,11 @@
1
+ ## v0.0.2 2015-09-08
2
+
3
+ ### Changed
4
+
5
+ * Method `Commands#execute` takes argument instead of a block (nepalez)
6
+
7
+ [Compare v0.0.1...v0.0.2](https://github.com/rom-rb/rom-cassandra/compare/v0.0.1...v0.0.2)
8
+
1
9
  ## v0.0.1 2015-08-27
2
10
 
3
11
  First public release
@@ -23,13 +23,13 @@ module ROM::Cassandra
23
23
 
24
24
  # Implements the execute method of the `ROM::Command` abstract class
25
25
  #
26
- # @yield the block to specify the statement.
26
+ # @param [ROM::Command] command The updated command
27
27
  #
28
28
  # @return [Array]
29
29
  # The empty array (Cassandra doesn't select rows when writes data).
30
30
  #
31
- def execute(*, &block)
32
- (block_given? ? instance_eval(&block) : self).to_a
31
+ def execute(command = self)
32
+ command.to_a
33
33
  end
34
34
 
35
35
  private
@@ -8,7 +8,7 @@ module ROM
8
8
  #
9
9
  # @see http://semver.org/ Semantic versioning 2.0
10
10
  #
11
- VERSION = "0.0.1".freeze
11
+ VERSION = "0.0.2".freeze
12
12
 
13
13
  end # module Cassandra
14
14
 
@@ -14,10 +14,8 @@ module ROM::Cassandra::Test # the namespace for newly created classes
14
14
  register_as :batch
15
15
 
16
16
  def execute
17
- super do
18
- add("DELETE FROM auth.users WHERE id = 1;")
19
- .add(keyspace(:auth).table(:users).insert(id: 3, name: "frank"))
20
- end
17
+ super add("DELETE FROM auth.users WHERE id = 1;")
18
+ .add(keyspace(:auth).table(:users).insert(id: 3, name: "frank"))
21
19
  end
22
20
  end
23
21
  end
@@ -14,7 +14,7 @@ module ROM::Cassandra::Test # the namespace for newly created classes
14
14
  register_as :create
15
15
 
16
16
  def execute(id, name)
17
- super { insert(id: id, name: name) }
17
+ super insert(id: id, name: name)
18
18
  end
19
19
  end
20
20
  end
@@ -14,7 +14,7 @@ module ROM::Cassandra::Test # the namespace for newly created classes
14
14
  register_as :delete
15
15
 
16
16
  def execute(id)
17
- super { where(id: 1) }
17
+ super where(id: id)
18
18
  end
19
19
  end
20
20
  end
@@ -14,7 +14,7 @@ module ROM::Cassandra::Test # the namespace for newly created classes
14
14
  register_as :update
15
15
 
16
16
  def execute(id, name)
17
- super { update(name: name).where(id: 1) }
17
+ super update(name: name).where(id: id)
18
18
  end
19
19
  end
20
20
  end
@@ -53,8 +53,8 @@ describe ROM::Cassandra::Commands::Batch do
53
53
  let(:updated) { double :updated, to_a: result }
54
54
  let(:result) { double :result }
55
55
 
56
- context "without a block" do
57
- subject { command.execute(1) }
56
+ context "without argument" do
57
+ subject { command.execute }
58
58
 
59
59
  it "applies #to_a" do
60
60
  allow(command).to receive(:to_a) { result }
@@ -63,12 +63,11 @@ describe ROM::Cassandra::Commands::Batch do
63
63
  end
64
64
  end
65
65
 
66
- context "with a block" do
67
- subject { command.execute { foo } }
66
+ context "with argument" do
67
+ subject { command.execute(updated) }
68
68
 
69
69
  it "updates and finalizes the command" do
70
- allow(command).to receive(:foo) { updated }
71
-
70
+ expect(updated).to receive(:to_a)
72
71
  expect(subject).to eql(result)
73
72
  end
74
73
  end
@@ -53,8 +53,8 @@ describe ROM::Cassandra::Commands::Create do
53
53
  let(:updated) { double :updated, to_a: result }
54
54
  let(:result) { double :result }
55
55
 
56
- context "without a block" do
57
- subject { command.execute(1) }
56
+ context "without argument" do
57
+ subject { command.execute }
58
58
 
59
59
  it "applies #to_a" do
60
60
  allow(command).to receive(:to_a) { result }
@@ -63,12 +63,11 @@ describe ROM::Cassandra::Commands::Create do
63
63
  end
64
64
  end
65
65
 
66
- context "with a block" do
67
- subject { command.execute { foo } }
66
+ context "with argument" do
67
+ subject { command.execute(updated) }
68
68
 
69
69
  it "updates and finalizes the command" do
70
- allow(command).to receive(:foo) { updated }
71
-
70
+ expect(updated).to receive(:to_a)
72
71
  expect(subject).to eql(result)
73
72
  end
74
73
  end
@@ -53,8 +53,8 @@ describe ROM::Cassandra::Commands::Delete do
53
53
  let(:updated) { double :updated, to_a: result }
54
54
  let(:result) { double :result }
55
55
 
56
- context "without a block" do
57
- subject { command.execute(1) }
56
+ context "without argument" do
57
+ subject { command.execute }
58
58
 
59
59
  it "applies #to_a" do
60
60
  allow(command).to receive(:to_a) { result }
@@ -63,12 +63,11 @@ describe ROM::Cassandra::Commands::Delete do
63
63
  end
64
64
  end
65
65
 
66
- context "with a block" do
67
- subject { command.execute { foo } }
66
+ context "with argument" do
67
+ subject { command.execute(updated) }
68
68
 
69
69
  it "updates and finalizes the command" do
70
- allow(command).to receive(:foo) { updated }
71
-
70
+ expect(updated).to receive(:to_a)
72
71
  expect(subject).to eql(result)
73
72
  end
74
73
  end
@@ -53,8 +53,8 @@ describe ROM::Cassandra::Commands::Update do
53
53
  let(:updated) { double :updated, to_a: result }
54
54
  let(:result) { double :result }
55
55
 
56
- context "without a block" do
57
- subject { command.execute(1) }
56
+ context "without argument" do
57
+ subject { command.execute }
58
58
 
59
59
  it "applies #to_a" do
60
60
  allow(command).to receive(:to_a) { result }
@@ -63,12 +63,11 @@ describe ROM::Cassandra::Commands::Update do
63
63
  end
64
64
  end
65
65
 
66
- context "with a block" do
67
- subject { command.execute { foo } }
66
+ context "with argument" do
67
+ subject { command.execute(updated) }
68
68
 
69
69
  it "updates and finalizes the command" do
70
- allow(command).to receive(:foo) { updated }
71
-
70
+ expect(updated).to receive(:to_a)
72
71
  expect(subject).to eql(result)
73
72
  end
74
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-cassandra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-27 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cassandra-driver
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
203
  version: '0'
204
204
  requirements: []
205
205
  rubyforge_project:
206
- rubygems_version: 2.4.6
206
+ rubygems_version: 2.4.8
207
207
  signing_key:
208
208
  specification_version: 4
209
209
  summary: Cassandra support for Ruby Object Mapper