json_attributes 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21b7be213ed1d90c4eaf28eab315b610b145b2cf
4
- data.tar.gz: df9f9ef3066c7bc2278cebca14f55519e1ef560d
3
+ metadata.gz: db24fc34e1e7b33164e8cfee8f345b156b849c09
4
+ data.tar.gz: d9ea002dfb0ecb40ecbd31679d87fc7847de9085
5
5
  SHA512:
6
- metadata.gz: bf23c52264ec498ddeb7b689e3b3390317975dfdb4af26d4c1c0551045bc3faea435513d51b74a089472ee0a6987e682ff8c8515cd03054db3414075916e8d7a
7
- data.tar.gz: 3fe220a993cd01a5371dc3bb42f6cf705df0e6b576d6817500e8af5cc52f59f413e5618186c8249feedfa725184c253715ecf2a7141f490ce5827d9b60582bd0
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
@@ -1,3 +1,7 @@
1
+ ### VERSION 0.1.1
2
+
3
+ * Bug fix
4
+
1
5
  ### VERSION 0.1.0
2
6
 
3
7
  * First release
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: postgresql
3
+ database: json_attributes_database
4
+ username: postgres
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 = (self.send(self.class.instance_variable_get(:@field)).try(:dup) || {}).with_indifferent_access
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
@@ -1,3 +1,3 @@
1
1
  module JsonAttributes
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  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.0
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-07-30 00:00:00.000000000 Z
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