activerecord-postgres-hstore-core 0.0.5 → 0.0.6
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.
data/README.rdoc
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module ActiveRecordPostgresHstore
|
2
|
-
VERSION = '0.0.
|
3
|
-
end
|
2
|
+
VERSION = '0.0.6'
|
3
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Coders
|
3
|
+
class Hstore
|
4
|
+
def self.load(hstore)
|
5
|
+
new.load(hstore)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.dump(hstore)
|
9
|
+
new.dump(hstore)
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(default=nil)
|
13
|
+
@default=default
|
14
|
+
end
|
15
|
+
|
16
|
+
def dump(obj)
|
17
|
+
obj.nil? ? (@default.nil? ? nil : @default.to_hstore) : obj.to_hstore
|
18
|
+
end
|
19
|
+
|
20
|
+
def load(hstore)
|
21
|
+
hstore.nil? ? nil : hstore.from_hstore
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe "ActiverecordCodersHstore" do
|
4
|
+
it 'should load nil' do
|
5
|
+
ActiveRecord::Coders::Hstore.load(nil).should be_nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should load an hstore' do
|
9
|
+
ActiveRecord::Coders::Hstore.load("a=>a").should == { 'a' => 'a' }
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should dump an hstore' do
|
13
|
+
ActiveRecord::Coders::Hstore.dump({'a'=>'a'}).should == {'a'=>'a'}.to_hstore
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should dump nil' do
|
17
|
+
ActiveRecord::Coders::Hstore.dump(nil).should be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should dump the default given nil' do
|
21
|
+
ActiveRecord::Coders::Hstore.new({'a'=>'a'}).dump(nil).should == {'a'=>'a'}.to_hstore
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgres-hstore-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jt Gleason
|
@@ -109,9 +109,11 @@ files:
|
|
109
109
|
- lib/activerecord-postgres-hstore-core.rb
|
110
110
|
- lib/activerecord-postgres-hstore-core/version.rb
|
111
111
|
- lib/activerecord_postgres_hstore_core/activerecord.rb
|
112
|
+
- lib/activerecord_postgres_hstore_core/coder.rb
|
112
113
|
- lib/activerecord_postgres_hstore_core/hash.rb
|
113
114
|
- lib/activerecord_postgres_hstore_core/string.rb
|
114
115
|
- rails/init.rb
|
116
|
+
- spec/activerecord_postgres_hstore_core/activerecord_coders_hstore.rb
|
115
117
|
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_database_spec.rb
|
116
118
|
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_datatype_spec.rb
|
117
119
|
- spec/database.yml.sample
|
@@ -152,6 +154,7 @@ signing_key:
|
|
152
154
|
specification_version: 3
|
153
155
|
summary: Hstore AR for Hstore DB
|
154
156
|
test_files:
|
157
|
+
- spec/activerecord_postgres_hstore_core/activerecord_coders_hstore.rb
|
155
158
|
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_database_spec.rb
|
156
159
|
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_datatype_spec.rb
|
157
160
|
- spec/database.yml.sample
|