gotime-cassandra_object 4.3.1 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'gotime-cassandra_object'
5
- s.version = '4.3.1'
5
+ s.version = '4.3.2'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
  s.authors = ["Michael Koziarski", "gotime"]
@@ -1,13 +1,17 @@
1
1
  module CassandraObject
2
2
  class Scope
3
3
  module QueryMethods
4
- def select!(value)
5
- self.select_values += Array.wrap(value)
4
+ def select!(*values)
5
+ self.select_values += values.flatten
6
6
  self
7
7
  end
8
8
 
9
- def select(value)
10
- clone.select! value
9
+ def select(*values, &block)
10
+ if block_given?
11
+ to_a.select(&block)
12
+ else
13
+ clone.select! *values
14
+ end
11
15
  end
12
16
 
13
17
  def where!(*values)
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class CassandraObject::QueryMethodsTest < CassandraObject::TestCase
3
+ class CassandraObject::Scope::QueryMethodsTest < CassandraObject::TestCase
4
4
  test "select" do
5
5
  issue = Issue.create title: 'foo', description: 'bar'
6
6
 
@@ -9,4 +9,11 @@ class CassandraObject::QueryMethodsTest < CassandraObject::TestCase
9
9
  assert_equal 'foo', issue.title
10
10
  assert_nil issue.description
11
11
  end
12
+
13
+ test "select with block" do
14
+ foo_issue = Issue.create title: 'foo'
15
+ bar_issue = Issue.create title: 'bar'
16
+
17
+ assert_equal [foo_issue], Issue.select { |issue| issue.title == 'foo' }
18
+ end
12
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotime-cassandra_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.1
4
+ version: 4.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: