lightweight_attributes 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/lightweight_attributes/attribute_set.rb +4 -0
- data/lib/lightweight_attributes/base_methods.rb +13 -0
- data/lightweight_attributes.gemspec +7 -4
- metadata +55 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 965c0ceb8662d2802425c705db0131956442afaa98f425f4507dee532ed34699
|
4
|
+
data.tar.gz: '0893c81e5530ad360f1b378a6306d05722d119f69ab3bda5613bc861ff72c8fd'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bda81118a9e589513c6f4ca595b2608cc89ec3106882e08fd8783470a235e03f7aa53f4dadbb60d41055b049cdb81bfc1a20572ad4d61893b9fc0c9d32847a5
|
7
|
+
data.tar.gz: d6ec7c9b89e1281ff8a655f0811149dc56f5ded81dc6ce959e15be3866ccb550b4287144951a8d66d43be4da75efb2189759678fc7c30a5a52a097be30ee7dbd
|
data/.gitignore
CHANGED
@@ -16,6 +16,11 @@ module LightweightAttributes
|
|
16
16
|
@attributes[attr_name] = value
|
17
17
|
end
|
18
18
|
|
19
|
+
# AR 5.0
|
20
|
+
private def write_attribute_with_type_cast(attr_name, value, _should_type_cast)
|
21
|
+
_write_attribute attr_name, value
|
22
|
+
end
|
23
|
+
|
19
24
|
#NOTE: Should be true for user posted Time Hash, but who cares?
|
20
25
|
def attribute_came_from_user?(_attribute_name)
|
21
26
|
false
|
@@ -50,7 +55,15 @@ module LightweightAttributes
|
|
50
55
|
end
|
51
56
|
|
52
57
|
private def forget_attribute_assignments
|
58
|
+
@changed_attributes.each do |k, v|
|
59
|
+
@attributes[k] = v
|
60
|
+
end
|
53
61
|
@changed_attributes.clear
|
54
62
|
end
|
63
|
+
|
64
|
+
# AR 5.0
|
65
|
+
def store_original_attributes
|
66
|
+
forget_attribute_assignments
|
67
|
+
end
|
55
68
|
end
|
56
69
|
end
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "lightweight_attributes"
|
6
|
-
spec.version = '0.
|
6
|
+
spec.version = '0.2.0'.freeze
|
7
7
|
spec.authors = ["Akira Matsuda"]
|
8
8
|
spec.email = ["ronnie@dio.jp"]
|
9
9
|
|
@@ -19,7 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency "
|
22
|
+
spec.add_dependency 'activerecord'
|
23
|
+
spec.add_development_dependency 'rails'
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "minitest"
|
27
|
+
spec.add_development_dependency 'sqlite3'
|
25
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightweight_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
@@ -10,48 +10,90 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
|
-
- - "
|
45
|
+
- - ">="
|
18
46
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
47
|
+
version: '0'
|
20
48
|
type: :development
|
21
49
|
prerelease: false
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
23
51
|
requirements:
|
24
|
-
- - "
|
52
|
+
- - ">="
|
25
53
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
|
-
- - "
|
59
|
+
- - ">="
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
61
|
+
version: '0'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
|
-
- - "
|
66
|
+
- - ">="
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
68
|
+
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: minitest
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
|
-
- - "
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
46
88
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
89
|
+
version: '0'
|
48
90
|
type: :development
|
49
91
|
prerelease: false
|
50
92
|
version_requirements: !ruby/object:Gem::Requirement
|
51
93
|
requirements:
|
52
|
-
- - "
|
94
|
+
- - ">="
|
53
95
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
96
|
+
version: '0'
|
55
97
|
description: Bring the speed back to your Active Record models!
|
56
98
|
email:
|
57
99
|
- ronnie@dio.jp
|