moped 1.1.0 → 1.1.1

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.

@@ -1,8 +1,17 @@
1
1
  # Overview
2
2
 
3
- ## 1.1.0 (branch: master)
3
+ ## 1.1.1
4
4
 
5
- ### New Features
5
+ ### Resolved Issues
6
+
7
+ * mongoid/mongoid\#2175 Fixed sorting by object ids.
8
+
9
+ ## 1.1.0
10
+
11
+ ### Resolved Issues
12
+
13
+ * \#29 Fixed endian directives order. Moped will now work properly on
14
+ all architectures. This removes support for MRI 1.9.2. (Miguel Herranz)
6
15
 
7
16
  ### Resolved Issues
8
17
 
@@ -5,15 +5,10 @@ module Moped
5
5
  module BSON
6
6
  class ObjectId
7
7
 
8
- # Formatting string for outputting an ObjectId.
9
- @@string_format = ("%02x" * 12).freeze
10
-
11
8
  class << self
12
9
  def from_string(string)
13
10
  raise Errors::InvalidObjectId.new(string) unless legal?(string)
14
- data = []
15
- 12.times { |i| data << string[i*2, 2].to_i(16) }
16
- from_data data.pack("C12")
11
+ from_data [string].pack("H*")
17
12
  end
18
13
 
19
14
  def from_time(time)
@@ -21,7 +16,7 @@ module Moped
21
16
  end
22
17
 
23
18
  def legal?(str)
24
- !!str.match(/\A\h{24}\Z/i)
19
+ /\A\h{24}\Z/ === str
25
20
  end
26
21
 
27
22
  def from_data(data)
@@ -44,12 +39,16 @@ module Moped
44
39
  end
45
40
  alias eql? ==
46
41
 
42
+ def <=>(other)
43
+ data <=> other.data
44
+ end
45
+
47
46
  def hash
48
47
  data.hash
49
48
  end
50
49
 
51
50
  def to_s
52
- @@string_format % data.unpack("C12")
51
+ data.unpack("H*")[0]
53
52
  end
54
53
 
55
54
  def inspect
@@ -531,13 +531,13 @@ module Moped
531
531
  instrument_start = (logger = Moped.logger) && logger.debug? && Time.new
532
532
  yield
533
533
  ensure
534
- log_operations(logger, operations, Time.new - instrument_start) if instrument_start
534
+ log_operations(logger, operations, 1000 * (Time.new.to_f - instrument_start.to_f)) if instrument_start
535
535
  end
536
536
 
537
- def log_operations(logger, ops, duration)
537
+ def log_operations(logger, ops, duration_ms)
538
538
  prefix = " MOPED: #{resolved_address} "
539
539
  indent = " "*prefix.length
540
- runtime = (" (%.4fms)" % duration)
540
+ runtime = (" (%.4fms)" % duration_ms)
541
541
 
542
542
  if ops.length == 1
543
543
  logger.debug prefix + ops.first.log_inspect + runtime
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
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.0
4
+ version: 1.1.1
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-06-30 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -117,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: -1860902879259909617
120
+ hash: 67884281380115062
121
121
  required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  none: false
123
123
  requirements:
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: -1860902879259909617
129
+ hash: 67884281380115062
130
130
  requirements: []
131
131
  rubyforge_project:
132
132
  rubygems_version: 1.8.24