couchbase-orm 0.0.5 → 0.0.6

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: 97d4d22e92253cd711eac00f3ef2be972e6a7edf
4
- data.tar.gz: 54c9999852f93b4e3cdbc0902e2f5e1eb5d41410
3
+ metadata.gz: 6b68fe44cc7da799f2e87e010a86bbdc8110afae
4
+ data.tar.gz: 2261e2cbe3d2d7daac611f9aa167ffdad4683495
5
5
  SHA512:
6
- metadata.gz: 0697517128397f38ed0e449ffc284a7df7023c73d04eeebd25d03cfc50af43702950d258a9de536835439bfd3ecddb0b29083df0bb5a583669f1ada6e69b00da
7
- data.tar.gz: ade8348fee4da31af06dcf5174dfe68b8b13619d5a490470add44e85c7d74983722223b8f076ab55cb03f2f9a76f7776c8fc910ebf31e6bb83df44e35a143fb5
6
+ metadata.gz: 52dd91e8aea71e0d3048486b4de9a7fa48ad6a5fe55e5e141c5037beb0b71764fab67ba22f6706372cf61b7a4a8c2d0dd3054a39d4d1c76c51a4b83f7bacea2d
7
+ data.tar.gz: dfaf5da9c871352fb05a75e3c670ca82f735641ffe0945943e609a519694c10881e7b62c2de04a62ff5202a918405f66bc08c20d89d1d4187a6f601067606416
data/lib/couchbase-orm.rb CHANGED
@@ -24,7 +24,7 @@ end
24
24
 
25
25
  # Provide Boolean conversion function
26
26
  # See: http://www.virtuouscode.com/2012/05/07/a-ruby-conversion-idiom/
27
- module Conversions
27
+ module Kernel
28
28
  private
29
29
 
30
30
  def Boolean(value)
@@ -92,7 +92,12 @@ module CouchbaseOrm
92
92
  options[:extended] = true
93
93
  options[:quiet] ||= false
94
94
 
95
- ids = ids.flatten
95
+ ids = ids.flatten.select { |id| id.present? }
96
+ if ids.empty?
97
+ return nil if options[:quiet]
98
+ raise Libcouchbase::Error::EmptyKey, 'no id(s) provided'
99
+ end
100
+
96
101
  records = bucket.get(*ids, **options)
97
102
 
98
103
  records = records.is_a?(Array) ? records : [records]
@@ -109,7 +114,7 @@ module CouchbaseOrm
109
114
 
110
115
  def find_by_id(*ids, **options)
111
116
  options[:quiet] = true
112
- find *ids, **options
117
+ find(*ids, **options)
113
118
  end
114
119
  alias_method :[], :find_by_id
115
120
 
@@ -213,9 +218,14 @@ module CouchbaseOrm
213
218
  end
214
219
 
215
220
  ID_LOOKUP = ['id', :id].freeze
216
- def read_attribute_for_serialization(attr)
217
- return self.id if ID_LOOKUP.include?(attr)
218
- @__attributes__[attr]
221
+ def attribute(name)
222
+ return self.id if ID_LOOKUP.include?(name)
223
+ @__attributes__[name]
224
+ end
225
+ alias_method :read_attribute_for_serialization, :attribute
226
+
227
+ def attribute=(name, value)
228
+ __send__(:"#{name}=", value)
219
229
  end
220
230
 
221
231
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true, encoding: ASCII-8BIT
2
2
 
3
3
  module CouchbaseOrm
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase-orm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-13 00:00:00.000000000 Z
11
+ date: 2016-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libcouchbase