moped 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of moped might be problematic. Click here for more details.

data/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Overview
2
2
 
3
- ## 1.1.4
3
+ ## 1.1.6 (branch: 1.1.0-stable)
4
+
5
+ ### Resolved Issues
6
+
7
+ * \#45 When providing database names with invalid characters in them, Moped
8
+ will now raise an `InvalidDatabaseName` error.
9
+
10
+ * \#41 `ObjectId.from_time` now only includes the timestamp, no machine or
11
+ process information.
12
+
13
+ ### Resolved Issues
14
+
15
+ ## 1.1.5
16
+
17
+ ### Resolved Issues
4
18
 
5
19
  * \#44 Fixed order of parameters for loading timestamps. (Ralf Kistner)
6
20
 
@@ -4,6 +4,7 @@ require "socket"
4
4
  module Moped
5
5
  module BSON
6
6
  class ObjectId
7
+ include Comparable
7
8
 
8
9
  class << self
9
10
  def from_string(string)
@@ -12,7 +13,7 @@ module Moped
12
13
  end
13
14
 
14
15
  def from_time(time)
15
- from_data @@generator.generate(time.to_i)
16
+ from_data [time.to_i].pack("Nx8")
16
17
  end
17
18
 
18
19
  def legal?(str)
@@ -100,6 +100,11 @@ module Moped
100
100
  #
101
101
  # @since 1.0.0
102
102
  def initialize(session, name)
103
+ if match = name.match(/\.|\s|\$|\\|\/|\x00/)
104
+ raise Errors::InvalidDatabaseName.new(
105
+ "Database names may not contain the character '#{match[0]}'."
106
+ )
107
+ end
103
108
  @session, @name = session, name
104
109
  end
105
110
 
data/lib/moped/errors.rb CHANGED
@@ -8,6 +8,9 @@ module Moped
8
8
  # Generic error class for exceptions related to connection failures.
9
9
  class ConnectionFailure < StandardError; end
10
10
 
11
+ # Raised when a database name is invalid.
12
+ class InvalidDatabaseName < StandardError; end
13
+
11
14
  # Raised when providing an invalid string from an object id.
12
15
  class InvalidObjectId < StandardError
13
16
 
data/lib/moped/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "1.1.5"
3
+ VERSION = "1.1.6"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moped
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-24 00:00:00.000000000 Z
12
+ date: 2012-07-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A MongoDB driver for Ruby.
15
15
  email:
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  segments:
87
87
  - 0
88
- hash: -183489421754413756
88
+ hash: -760618037812365492
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: -183489421754413756
97
+ hash: -760618037812365492
98
98
  requirements: []
99
99
  rubyforge_project:
100
100
  rubygems_version: 1.8.24