store_model 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/store_model/model.rb +19 -0
- data/lib/store_model/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6139e784c55ab957dc9de25a43b4727c91333dde4b7c92f4f22ea2634c204bf5
|
4
|
+
data.tar.gz: 04ae362612c4032445da8b05320e0d95f29a4b825bba751fa72811aabae263bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc7e96d96c1d4e8b7074b7d4000755137b3199b55769ff5e57ad59235e79cde8441e80d59133a54981788a94202df8b698484a896d4ea2d22dd90fdb3633736f
|
7
|
+
data.tar.gz: '001499ba6ff97ee59dc16fca855fbd9128fe9f6f85d4fe37438f4ea13bdea5ae81bf6da9281b8436b816573be6c79a15f68c6fdb0c3b610e7d23a897ba762b6b'
|
data/lib/store_model/model.rb
CHANGED
@@ -23,6 +23,8 @@ module StoreModel
|
|
23
23
|
|
24
24
|
attr_accessor :parent
|
25
25
|
|
26
|
+
delegate :each_value, :fetch, to: :attributes
|
27
|
+
|
26
28
|
# Returns a hash representing the model. Some configuration can be
|
27
29
|
# passed through +options+.
|
28
30
|
#
|
@@ -53,6 +55,23 @@ module StoreModel
|
|
53
55
|
end
|
54
56
|
alias eql? ==
|
55
57
|
|
58
|
+
# Accessing attribute using brackets
|
59
|
+
#
|
60
|
+
# @return [Object]
|
61
|
+
def [](attr_name)
|
62
|
+
@attributes.fetch_value(attr_name.to_s)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Setting attribute using brackets
|
66
|
+
#
|
67
|
+
# @param name [String, Symbol]
|
68
|
+
# @param value [Object]
|
69
|
+
#
|
70
|
+
# @return [Object]
|
71
|
+
def []=(attr_name, value)
|
72
|
+
@attributes.write_from_user(attr_name.to_s, value)
|
73
|
+
end
|
74
|
+
|
56
75
|
# Returns hash for a StoreModel::Model instance based on attributes hash
|
57
76
|
#
|
58
77
|
# @return [Integer]
|
data/lib/store_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: store_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -120,7 +120,7 @@ homepage: https://github.com/DmitryTsepelev/store_model
|
|
120
120
|
licenses:
|
121
121
|
- MIT
|
122
122
|
metadata: {}
|
123
|
-
post_install_message:
|
123
|
+
post_install_message:
|
124
124
|
rdoc_options: []
|
125
125
|
require_paths:
|
126
126
|
- lib
|
@@ -135,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
139
|
-
signing_key:
|
138
|
+
rubygems_version: 3.1.6
|
139
|
+
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Gem for working with JSON-backed attributes as ActiveRecord models
|
142
142
|
test_files: []
|