orientdb-binary 0.6.0 → 0.7.0

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: 822de4e7fe6c71ba013c1a5ff83d47359fc29bf9
4
- data.tar.gz: 20409e9c8397250249a51a4f94da04613d094846
3
+ metadata.gz: 483a460ffe7adabe38fcdc83ccabf71c76b3381e
4
+ data.tar.gz: e5ae7de8051cd0aff177aa923c849f054dbb4fa9
5
5
  SHA512:
6
- metadata.gz: b3593c9e0a8f34d3777de2a1f8bdf916c48cf5667168de66482c2f8df689f1e3345d28978760962f6fbfa0eb78936824357492108c09632a5fb70c0d477e4c88
7
- data.tar.gz: 7df96f629462b46a538f68e7fd93ff0cc19e2d6beccbf5b925587f3a8f345e9b1af6d2e65a52e8e80311de01c473f39af9ccf85f6ceb040d8d7e613213585491
6
+ metadata.gz: 0fa2d9e79d8f4849af773e273dc1498c6f1e0b1d0d2d893afffa0d8d3dfdb919574bd4461dd3a659fc7f79da09758df2b027cee16abdec3faae7b2b0caced534
7
+ data.tar.gz: 5777ffec8ad36e4812b0ad5db63c230933d78d0be82a55443bd17de43afb9a36b7ae630581305c57a3cde3510bc3414c5197b05d245eb7030982fef2cdc89cf2
data/Gemfile.lock ADDED
@@ -0,0 +1,27 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ orientdb-binary (0.7.0)
5
+ bindata (~> 1.8)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ bindata (1.8.2)
11
+ docile (1.1.2)
12
+ multi_json (1.8.4)
13
+ rake (0.9.6)
14
+ simplecov (0.8.2)
15
+ docile (~> 1.1.0)
16
+ multi_json
17
+ simplecov-html (~> 0.8.0)
18
+ simplecov-html (0.8.0)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ bundler (~> 1.5)
25
+ orientdb-binary!
26
+ rake (~> 0.9)
27
+ simplecov (~> 0.8)
@@ -6,6 +6,7 @@ require 'date'
6
6
 
7
7
  require "orientdb_binary/config"
8
8
 
9
+ require 'orientdb_binary/record_id'
9
10
  require 'orientdb_binary/parser/deserializer'
10
11
  require 'orientdb_binary/parser/serializer'
11
12
 
@@ -1,5 +1,5 @@
1
1
  module OrientdbBinary
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  NAME = "OrientDB Binary Protocol Ruby Client"
4
4
  PROTOCOL_VERSION = 20
5
5
  end
@@ -46,6 +46,7 @@ module OrientdbBinary
46
46
  end
47
47
 
48
48
  def deserialize_field_value(value)
49
+ return Orientdb::RecordId.new value if /^[#]?(?<cluster>-?\d+):(?<position>\d+)$/.match(value)
49
50
  return nil if value.empty?
50
51
 
51
52
  if ["true", "false"].include? value
@@ -0,0 +1,38 @@
1
+ module Orientdb
2
+ class RecordId
3
+ attr_accessor :cluster, :position
4
+
5
+ alias_method :eql?, :==
6
+
7
+ def initialize(rid=nil)
8
+ @cluster = nil
9
+ @position = nil
10
+ if rid.is_a? String and not rid.empty?
11
+ parse_rid(rid)
12
+ elsif rid.is_a? Orientdb::RecordId
13
+ @cluster = rid.cluster
14
+ @position = rid.position
15
+ end
16
+ end
17
+
18
+ def parse_rid(rid)
19
+ match = rid.match(/^[#]?(?<cluster>-?\d+):(?<position>\d+)$/)
20
+ @cluster = match[:cluster].to_i
21
+ @position = match[:position].to_i
22
+ self
23
+ end
24
+
25
+ def to_s
26
+ "##{cluster}:#{position}"
27
+ end
28
+
29
+ def temporary?
30
+ @cluster < 0
31
+ end
32
+
33
+ def ==(o)
34
+ o.class == self.class && o.cluster == self.cluster && o.position == self.position
35
+ end
36
+
37
+ end
38
+ end
@@ -31,7 +31,7 @@ describe OrientdbBinary::Parser do
31
31
  end
32
32
 
33
33
  it "should parse rid in set" do
34
- assert @result[:a_set].include? "#12:1"
34
+ assert_equal Orientdb::RecordId.new('#12:1'), @result[:a_set].to_a.last
35
35
  end
36
36
  end
37
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orientdb-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Ostrowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2014-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - Gemfile
78
+ - Gemfile.lock
78
79
  - LICENSE.txt
79
80
  - README.md
80
81
  - Rakefile
@@ -123,6 +124,7 @@ files:
123
124
  - lib/orientdb_binary/protocols/record_load.rb
124
125
  - lib/orientdb_binary/protocols/record_update.rb
125
126
  - lib/orientdb_binary/protocols/shutdown.rb
127
+ - lib/orientdb_binary/record_id.rb
126
128
  - lib/orientdb_binary/server.rb
127
129
  - orientdb-binary.gemspec
128
130
  - test/database/test_database.rb