tallty_duck_record 1.0.1 → 1.1.3

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
  SHA256:
3
- metadata.gz: 13519264c45683755376962602255447fa0c917fa664135794691b73883cb494
4
- data.tar.gz: f28955103e902cba1ee4b89de063eeea2031f07e902ede4883133c05c1c7c058
3
+ metadata.gz: 036c3954f67fb6dd302c710328b6fbaf05916a84d6b83d95ea93fea075eca36a
4
+ data.tar.gz: 98a19e78d57229b8108f855c4173f5889fc35d8e34560e8cd62f4d490c06b424
5
5
  SHA512:
6
- metadata.gz: 865d2b950b25104831ab58ff1476701ea7460217009f36e5062af8c502f5a58007041e113297d0e64d898c9f5037d1696a704ba035f9b3e5c860ccbafa6522c9
7
- data.tar.gz: 439833d5a4fc1bc51a35c21f0363fa9852e59c11bc5a4df296286a4753028249dbc3f38a18c52420ab28774887d2b652cc0f44df9406d93e804a9209e6004ffe
6
+ metadata.gz: 9ac3b352bcdd28577839b900d0bee2b2f8409a532ea8deb4a638be7440abae84435e53d78c01a682dc0155af6b81d09f06ec700b4e1036cd89e9dd8af76b6cf2
7
+ data.tar.gz: ea0ebfbc42e4a9841c8d55ae9a368db23c5ea5c044b497fcbfbfd4f329cfaa964c86522bc106c7bf59fcc6e4021e3c534fec3962f62ffd19afc5bd6c9529afb5
@@ -1,7 +1,9 @@
1
- class MetaRecord < MetaStrictRecord
2
- def _assign_attribute(k, v)
3
- if respond_to?("#{k}=")
4
- public_send("#{k}=", v)
1
+ module DuckRecord
2
+ class MetaRecord < MetaStrictRecord
3
+ def _assign_attribute(k, v)
4
+ if respond_to?("#{k}=")
5
+ public_send("#{k}=", v)
6
+ end
5
7
  end
6
8
  end
7
9
  end
@@ -1,38 +1,39 @@
1
- class MetaStrictRecord < DuckRecord::Base
2
- attr_accessor :raw_attributes
1
+ module DuckRecord
2
+ class MetaStrictRecord < DuckRecord::Base
3
+ attr_accessor :raw_attributes
3
4
 
4
- def serializable_hash(options = {})
5
- options = (options || {}).reverse_merge include: self.class._embeds_reflections.keys
6
- super options
7
- end
8
-
9
- class << self
10
- def _embeds_reflections
11
- _reflections.select { |_, v| v.is_a? DuckRecord::Reflection::EmbedsAssociationReflection }
5
+ def serializable_hash(options = {})
6
+ options = (options || {}).reverse_merge include: self.class._embeds_reflections.keys
7
+ super options
12
8
  end
13
9
 
14
- def dump(obj)
15
- serializable_hash =
16
- if obj.respond_to?(:serializable_hash)
17
- obj.serializable_hash
18
- elsif obj.respond_to?(:to_hash)
19
- obj.to_hash
20
- else
21
- raise ArgumentError, "`obj` required can be cast to `Hash` -- #{obj.class}"
22
- end.stringify_keys
23
- return serializable_hash
24
- end
10
+ class << self
11
+ def _embeds_reflections
12
+ _reflections.select { |_, v| v.is_a? DuckRecord::Reflection::EmbedsAssociationReflection }
13
+ end
25
14
 
26
- def load(hash)
27
- case hash
28
- when Hash
29
- record = new hash
30
- record.raw_attributes = hash.with_indifferent_access
31
- return record
32
- else
33
- new
15
+ def dump(obj)
16
+ serializable_hash =
17
+ if obj.respond_to?(:serializable_hash)
18
+ obj.serializable_hash
19
+ elsif obj.respond_to?(:to_hash)
20
+ obj.to_hash
21
+ else
22
+ raise ArgumentError, "`obj` required can be cast to `Hash` -- #{obj.class}"
23
+ end.stringify_keys
24
+ return serializable_hash
25
+ end
26
+
27
+ def load(hash)
28
+ case hash
29
+ when Hash
30
+ record = new hash
31
+ record.raw_attributes = hash.with_indifferent_access
32
+ return record
33
+ else
34
+ new
35
+ end
34
36
  end
35
37
  end
36
38
  end
37
39
  end
38
-
@@ -1,3 +1,3 @@
1
1
  module DuckRecord
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tallty_duck_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tallty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-18 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.3
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.3
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 6.0.3
33
+ version: '5.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 6.0.3
40
+ version: '5.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 6.0.3
47
+ version: '5.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 6.0.3
54
+ version: '5.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement