shadow_model 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/shadow_model/{extension.rb → model_extension.rb} +7 -1
- data/lib/shadow_model/version.rb +1 -1
- data/lib/shadow_model.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9518b18405e37c61c19150b09c2c4203592b6584
|
4
|
+
data.tar.gz: cb61c047872eb147c663f91f17a2e4879e4370b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc810d648888fc744c8fc6f781e6fad8adb0102e19d89e2e9648a942c4d6cc1247f659b186360795446644782d2d55940a58f5acc16f675665a4efe16f76908e
|
7
|
+
data.tar.gz: fd22eef1713aef85f2d4f7d1fc31aea29bc50c25f33feebab4e1d91ecf8bffc4269ea2eb70c95ed6613c3f1174a9b9de6a88812c7479431e44f8ea70df3bbea2
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A rails plugin use redis to cache models data.
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/cctiger36/shadow_model.png?branch=master)](https://travis-ci.org/cctiger36/shadow_model) [![Gem Version](https://badge.fury.io/rb/shadow_model.png)](http://badge.fury.io/rb/shadow_model) [![Coverage Status](https://coveralls.io/repos/cctiger36/shadow_model/badge.png)](https://coveralls.io/r/cctiger36/shadow_model) [![Code Climate](https://codeclimate.com/github/cctiger36/shadow_model.png)](https://codeclimate.com/github/cctiger36/shadow_model)
|
5
|
+
[![Build Status](https://travis-ci.org/cctiger36/shadow_model.png?branch=master)](https://travis-ci.org/cctiger36/shadow_model) [![Gem Version](https://badge.fury.io/rb/shadow_model.png)](http://badge.fury.io/rb/shadow_model) [![Coverage Status](https://coveralls.io/repos/cctiger36/shadow_model/badge.png)](https://coveralls.io/r/cctiger36/shadow_model) [![Code Climate](https://codeclimate.com/github/cctiger36/shadow_model.png)](https://codeclimate.com/github/cctiger36/shadow_model) [![Dependency Status](https://gemnasium.com/cctiger36/shadow_model.png)](https://gemnasium.com/cctiger36/shadow_model)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ShadowModel
|
2
|
-
module
|
2
|
+
module ModelExtension
|
3
3
|
def self.included(base)
|
4
4
|
base.class_eval <<-RUBY
|
5
5
|
mattr_accessor :shadow_options
|
@@ -26,6 +26,12 @@ module ShadowModel
|
|
26
26
|
|
27
27
|
def shadow_data=(data)
|
28
28
|
@shadow_data = data
|
29
|
+
self.class.attribute_names.each do |attribute_name|
|
30
|
+
attribute_name = attribute_name.to_sym
|
31
|
+
if value = data[attribute_name]
|
32
|
+
self[attribute_name] = value
|
33
|
+
end
|
34
|
+
end
|
29
35
|
end
|
30
36
|
|
31
37
|
def clear_shadow_data
|
data/lib/shadow_model/version.rb
CHANGED
data/lib/shadow_model.rb
CHANGED
@@ -5,12 +5,12 @@ require 'shadow_model/version'
|
|
5
5
|
module ShadowModel
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
autoload :
|
8
|
+
autoload :ModelExtension, 'shadow_model/model_extension'
|
9
9
|
|
10
10
|
module ClassMethods
|
11
11
|
def shadow_model(*args)
|
12
12
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
13
|
-
self.send :include, ShadowModel::
|
13
|
+
self.send :include, ShadowModel::ModelExtension
|
14
14
|
set_shadow_keys(args, options)
|
15
15
|
end
|
16
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shadow_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weihu Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -87,7 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- lib/shadow_model/
|
90
|
+
- lib/shadow_model/model_extension.rb
|
91
91
|
- lib/shadow_model/version.rb
|
92
92
|
- lib/shadow_model.rb
|
93
93
|
- MIT-LICENSE
|