easymongo 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 358fd580d255a0fa18aec794cae7ea04a69b65f8
4
- data.tar.gz: 1a2aa93b40bfbe10ee245f3ab7f997e8c9911351
3
+ metadata.gz: a7a9dd9ec2c1e02958a6dea51c016098503339f1
4
+ data.tar.gz: 8256ef14714ce68534054e91cfce80ee325d5d37
5
5
  SHA512:
6
- metadata.gz: 22e087d5f0807696df516c6761876435d39a2cc9fdea360e9184892fe00ed6a06f018c9ff8f3d6ef992af8bad5ec8edae8eccc7a715d1d3d46f6f17f27f75a0b
7
- data.tar.gz: 2f67a54e70d6fb0638dde10f5c163cf9220680e3cd0708b25f1684c1fcff5342f70f682b96fdd59b9da0976c760e738ff2ed657ca20f4375f70b792729241d61
6
+ metadata.gz: bafd27e6d32f98977fbf35de10c78199c2af622b0130d5c4165cd292419dfd5438aacad180b92d5ed5f2975d6ed2ab5a4dfd247b5cd26b348cdf30ae0dc10b8f
7
+ data.tar.gz: 51d756276a046a0a0c480b12bdbb9cc5f6516135c92698e28455dd2372b97fbaae792e7be2625bb2a4bb9a47b21454a45dfc96e6d91ac8224bebe5e9d5461e12
@@ -1,3 +1,8 @@
1
+ **Version 0.0.4** - *2017-07-13*
2
+
3
+ - Simplified result
4
+
5
+
1
6
  **Version 0.0.3** - *2017-07-13*
2
7
 
3
8
  - Fixed JSON issues
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'easymongo'
3
- s.version = '0.0.3'
3
+ s.version = '0.0.4'
4
4
  s.date = '2017-07-13'
5
5
  s.summary = "Super Easy MongoDB client"
6
6
  s.description = "The way MongoDB for Ruby should be, can't get easier than this"
@@ -2,8 +2,7 @@ require 'mongo'
2
2
 
3
3
  module Easymongo
4
4
 
5
- # # # # # #
6
- # Easymongo MongoDB tiny Ruby library.
5
+ # Easymongo MongoDB super easy Ruby library.
7
6
  # @homepage: https://github.com/fugroup/easymongo
8
7
  # @author: Vidar <vidar@fugroup.net>, Fugroup Ltd.
9
8
  # @license: MIT, contributions are welcome.
@@ -14,6 +14,7 @@ module Easymongo
14
14
 
15
15
  # Write variables
16
16
  doc.each{|k, v| attr(k, v)}
17
+
17
18
  end
18
19
 
19
20
  # Get bson id
@@ -23,7 +24,7 @@ module Easymongo
23
24
 
24
25
  # Creation date
25
26
  def date
26
- bson_id.generation_time
27
+ bson_id.generation_time rescue nil
27
28
  end
28
29
 
29
30
  # Dynamically write value
@@ -1,6 +1,5 @@
1
1
  # This is the easiest possible implementation of a mongodb client.
2
2
  # We got rid of the ObjectID and the underscore, and made mongodb super easy to use.
3
- # Use BSON::ObjectId.new.generation_time as timestamp if you need that
4
3
  #
5
4
  # If you need something close to pure Mongo, check out https://github.com/fugroup/minimongo
6
5
  # If you need models for Easymongo, check out https://github.com/fugroup/modelize
@@ -23,7 +22,7 @@ module Easymongo
23
22
 
24
23
  # Set up collection, stored in the thread
25
24
  def method_missing(name, *args, &block)
26
- s[:coll] = name; self
25
+ c!; s[:coll] = name; self
27
26
  end
28
27
 
29
28
  # Set values
@@ -44,7 +43,7 @@ module Easymongo
44
43
  result = client[coll].update_one(data, options, :upsert => true)
45
44
 
46
45
  # Return result
47
- Easymongo::Result.new(result, data, values, options)
46
+ Easymongo::Result.new(result)
48
47
  end
49
48
 
50
49
  # Get values, store cursor in thread
@@ -92,7 +91,7 @@ module Easymongo
92
91
  result = client[coll].delete_one(data)
93
92
 
94
93
  # Return result
95
- Easymongo::Result.new(result, data).tap{ c!}
94
+ Easymongo::Result.new(result).tap{ c!}
96
95
  end
97
96
 
98
97
  # Make sure data is optimal
@@ -1,19 +1,16 @@
1
1
  module Easymongo
2
2
  class Result
3
3
 
4
- attr_accessor :result, :data, :values, :options
4
+ attr_reader :result
5
5
 
6
6
  # Init takes a Mongo::Operation::Result
7
- def initialize(result, data, values = nil, options = nil)
8
- self.result = result
9
- self.data = data
10
- self.values = values
11
- self.options = options
7
+ def initialize(result)
8
+ @result = result
12
9
  end
13
10
 
14
11
  # Get the id as BSON::ObjectId
15
12
  def bson_id
16
- result.upserted_id || data['_id']
13
+ result.upserted_id rescue nil
17
14
  end
18
15
 
19
16
  # Get the id if available
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easymongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.6.10
106
+ rubygems_version: 2.6.12
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Super Easy MongoDB client