json_attributes 0.1.0 → 0.1.1
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 +4 -4
- data/.travis.yml +6 -0
- data/CHANGELOG.md +4 -0
- data/config/travis/database.yml +4 -0
- data/db/structure.sql +15 -0
- data/lib/json_attributes/legacy_attributes.rb +6 -2
- data/lib/json_attributes/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db24fc34e1e7b33164e8cfee8f345b156b849c09
|
4
|
+
data.tar.gz: d9ea002dfb0ecb40ecbd31679d87fc7847de9085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc6fca4c0f722c788d42658c053dfe4310a98648ddc87cc72c869fe9e4826f6b03dcbb218146499ccf276ecd870e7e20616ea2253b4170d683082465639f5da7
|
7
|
+
data.tar.gz: 6d0bc8d2a39d7454d284f26c283407fdb31d11c2f5ffefa67918b92a12ca0f82f6a7215d637b40c519df3413fcc6d368911e56fdde31bcc7cfbc7cb8e750f0cc
|
data/.travis.yml
CHANGED
@@ -2,3 +2,9 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 2.2.2
|
4
4
|
before_install: gem install bundler -v 1.10.5
|
5
|
+
addons:
|
6
|
+
postgresql: '9.4'
|
7
|
+
before_script:
|
8
|
+
- psql -c 'create database json_attributes_database;' -U postgres
|
9
|
+
- psql -U postgres -q -d json_attributes_database -f db/structure.sql
|
10
|
+
- cp -f config/travis/database.yml config/database.yml
|
data/CHANGELOG.md
CHANGED
data/db/structure.sql
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
--
|
2
|
+
-- PostgreSQL database dump
|
3
|
+
--
|
4
|
+
|
5
|
+
--
|
6
|
+
-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
7
|
+
--
|
8
|
+
|
9
|
+
CREATE TABLE users (
|
10
|
+
id integer NOT NULL,
|
11
|
+
name character varying NOT NULL,
|
12
|
+
office json,
|
13
|
+
created_at timestamp without time zone,
|
14
|
+
updated_at timestamp without time zone
|
15
|
+
);
|
@@ -1,9 +1,13 @@
|
|
1
1
|
module JsonAttributes::LegacyAttributes
|
2
2
|
|
3
3
|
def attributes
|
4
|
-
_json_attrs =
|
4
|
+
_json_attrs = if self.class.instance_variable_get(:@field)
|
5
|
+
self.send(self.class.instance_variable_get(:@field)).dup
|
6
|
+
else
|
7
|
+
{}
|
8
|
+
end.with_indifferent_access
|
5
9
|
|
6
|
-
self.class.instance_variable_get(:@json_attrs).each do |_attribute|
|
10
|
+
(self.class.instance_variable_get(:@json_attrs) || []).each do |_attribute|
|
7
11
|
_json_attrs[_attribute] = nil unless _json_attrs.has_key?(_attribute)
|
8
12
|
_json_attrs[_attribute] ||= self.send(_attribute)
|
9
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel AZEMAR
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -102,6 +102,8 @@ files:
|
|
102
102
|
- UPGRADE.md
|
103
103
|
- bin/console
|
104
104
|
- bin/setup
|
105
|
+
- config/travis/database.yml
|
106
|
+
- db/structure.sql
|
105
107
|
- json_attributes.gemspec
|
106
108
|
- lib/json_attributes.rb
|
107
109
|
- lib/json_attributes/legacy_attributes.rb
|