tallty_duck_record 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +41 -0
  3. data/README.md +82 -0
  4. data/Rakefile +28 -0
  5. data/lib/core_ext/array_without_blank.rb +46 -0
  6. data/lib/duck_record.rb +65 -0
  7. data/lib/duck_record/associations.rb +130 -0
  8. data/lib/duck_record/associations/association.rb +271 -0
  9. data/lib/duck_record/associations/belongs_to_association.rb +71 -0
  10. data/lib/duck_record/associations/builder/association.rb +127 -0
  11. data/lib/duck_record/associations/builder/belongs_to.rb +44 -0
  12. data/lib/duck_record/associations/builder/collection_association.rb +45 -0
  13. data/lib/duck_record/associations/builder/embeds_many.rb +9 -0
  14. data/lib/duck_record/associations/builder/embeds_one.rb +9 -0
  15. data/lib/duck_record/associations/builder/has_many.rb +11 -0
  16. data/lib/duck_record/associations/builder/has_one.rb +20 -0
  17. data/lib/duck_record/associations/builder/singular_association.rb +33 -0
  18. data/lib/duck_record/associations/collection_association.rb +476 -0
  19. data/lib/duck_record/associations/collection_proxy.rb +1160 -0
  20. data/lib/duck_record/associations/embeds_association.rb +92 -0
  21. data/lib/duck_record/associations/embeds_many_association.rb +203 -0
  22. data/lib/duck_record/associations/embeds_many_proxy.rb +892 -0
  23. data/lib/duck_record/associations/embeds_one_association.rb +48 -0
  24. data/lib/duck_record/associations/foreign_association.rb +11 -0
  25. data/lib/duck_record/associations/has_many_association.rb +17 -0
  26. data/lib/duck_record/associations/has_one_association.rb +39 -0
  27. data/lib/duck_record/associations/singular_association.rb +73 -0
  28. data/lib/duck_record/attribute.rb +213 -0
  29. data/lib/duck_record/attribute/user_provided_default.rb +30 -0
  30. data/lib/duck_record/attribute_assignment.rb +118 -0
  31. data/lib/duck_record/attribute_decorators.rb +89 -0
  32. data/lib/duck_record/attribute_methods.rb +325 -0
  33. data/lib/duck_record/attribute_methods/before_type_cast.rb +76 -0
  34. data/lib/duck_record/attribute_methods/dirty.rb +107 -0
  35. data/lib/duck_record/attribute_methods/read.rb +78 -0
  36. data/lib/duck_record/attribute_methods/serialization.rb +66 -0
  37. data/lib/duck_record/attribute_methods/write.rb +70 -0
  38. data/lib/duck_record/attribute_mutation_tracker.rb +108 -0
  39. data/lib/duck_record/attribute_set.rb +98 -0
  40. data/lib/duck_record/attribute_set/yaml_encoder.rb +41 -0
  41. data/lib/duck_record/attributes.rb +262 -0
  42. data/lib/duck_record/base.rb +300 -0
  43. data/lib/duck_record/callbacks.rb +324 -0
  44. data/lib/duck_record/coders/json.rb +13 -0
  45. data/lib/duck_record/coders/yaml_column.rb +48 -0
  46. data/lib/duck_record/core.rb +262 -0
  47. data/lib/duck_record/define_callbacks.rb +23 -0
  48. data/lib/duck_record/enum.rb +139 -0
  49. data/lib/duck_record/errors.rb +71 -0
  50. data/lib/duck_record/inheritance.rb +130 -0
  51. data/lib/duck_record/locale/en.yml +46 -0
  52. data/lib/duck_record/model_schema.rb +71 -0
  53. data/lib/duck_record/nested_attributes.rb +555 -0
  54. data/lib/duck_record/nested_validate_association.rb +262 -0
  55. data/lib/duck_record/persistence.rb +39 -0
  56. data/lib/duck_record/readonly_attributes.rb +36 -0
  57. data/lib/duck_record/reflection.rb +650 -0
  58. data/lib/duck_record/serialization.rb +26 -0
  59. data/lib/duck_record/translation.rb +22 -0
  60. data/lib/duck_record/type.rb +77 -0
  61. data/lib/duck_record/type/array.rb +36 -0
  62. data/lib/duck_record/type/array_without_blank.rb +36 -0
  63. data/lib/duck_record/type/date.rb +7 -0
  64. data/lib/duck_record/type/date_time.rb +7 -0
  65. data/lib/duck_record/type/decimal_without_scale.rb +13 -0
  66. data/lib/duck_record/type/internal/abstract_json.rb +33 -0
  67. data/lib/duck_record/type/internal/timezone.rb +15 -0
  68. data/lib/duck_record/type/json.rb +6 -0
  69. data/lib/duck_record/type/registry.rb +97 -0
  70. data/lib/duck_record/type/serialized.rb +63 -0
  71. data/lib/duck_record/type/text.rb +9 -0
  72. data/lib/duck_record/type/time.rb +19 -0
  73. data/lib/duck_record/type/unsigned_integer.rb +15 -0
  74. data/lib/duck_record/validations.rb +67 -0
  75. data/lib/duck_record/validations/subset.rb +74 -0
  76. data/lib/duck_record/validations/uniqueness_on_real_record.rb +248 -0
  77. data/lib/duck_record/version.rb +3 -0
  78. data/lib/tasks/acts_as_record_tasks.rake +4 -0
  79. metadata +181 -0
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tallty_duck_record
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - tallty
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-11-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 6.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: activemodel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 6.0.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 6.0.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 6.0.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 6.0.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: |-
70
+ It looks like Active Record and quacks like Active Record, but it can't do persistence or querying,
71
+ it's Duck Record!
72
+ Actually it's extract from Active Record.
73
+ Used for creating virtual models like ActiveType or ModelAttribute does.
74
+ email:
75
+ - dev@tallty.com
76
+ executables: []
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - MIT-LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - lib/core_ext/array_without_blank.rb
84
+ - lib/duck_record.rb
85
+ - lib/duck_record/associations.rb
86
+ - lib/duck_record/associations/association.rb
87
+ - lib/duck_record/associations/belongs_to_association.rb
88
+ - lib/duck_record/associations/builder/association.rb
89
+ - lib/duck_record/associations/builder/belongs_to.rb
90
+ - lib/duck_record/associations/builder/collection_association.rb
91
+ - lib/duck_record/associations/builder/embeds_many.rb
92
+ - lib/duck_record/associations/builder/embeds_one.rb
93
+ - lib/duck_record/associations/builder/has_many.rb
94
+ - lib/duck_record/associations/builder/has_one.rb
95
+ - lib/duck_record/associations/builder/singular_association.rb
96
+ - lib/duck_record/associations/collection_association.rb
97
+ - lib/duck_record/associations/collection_proxy.rb
98
+ - lib/duck_record/associations/embeds_association.rb
99
+ - lib/duck_record/associations/embeds_many_association.rb
100
+ - lib/duck_record/associations/embeds_many_proxy.rb
101
+ - lib/duck_record/associations/embeds_one_association.rb
102
+ - lib/duck_record/associations/foreign_association.rb
103
+ - lib/duck_record/associations/has_many_association.rb
104
+ - lib/duck_record/associations/has_one_association.rb
105
+ - lib/duck_record/associations/singular_association.rb
106
+ - lib/duck_record/attribute.rb
107
+ - lib/duck_record/attribute/user_provided_default.rb
108
+ - lib/duck_record/attribute_assignment.rb
109
+ - lib/duck_record/attribute_decorators.rb
110
+ - lib/duck_record/attribute_methods.rb
111
+ - lib/duck_record/attribute_methods/before_type_cast.rb
112
+ - lib/duck_record/attribute_methods/dirty.rb
113
+ - lib/duck_record/attribute_methods/read.rb
114
+ - lib/duck_record/attribute_methods/serialization.rb
115
+ - lib/duck_record/attribute_methods/write.rb
116
+ - lib/duck_record/attribute_mutation_tracker.rb
117
+ - lib/duck_record/attribute_set.rb
118
+ - lib/duck_record/attribute_set/yaml_encoder.rb
119
+ - lib/duck_record/attributes.rb
120
+ - lib/duck_record/base.rb
121
+ - lib/duck_record/callbacks.rb
122
+ - lib/duck_record/coders/json.rb
123
+ - lib/duck_record/coders/yaml_column.rb
124
+ - lib/duck_record/core.rb
125
+ - lib/duck_record/define_callbacks.rb
126
+ - lib/duck_record/enum.rb
127
+ - lib/duck_record/errors.rb
128
+ - lib/duck_record/inheritance.rb
129
+ - lib/duck_record/locale/en.yml
130
+ - lib/duck_record/model_schema.rb
131
+ - lib/duck_record/nested_attributes.rb
132
+ - lib/duck_record/nested_validate_association.rb
133
+ - lib/duck_record/persistence.rb
134
+ - lib/duck_record/readonly_attributes.rb
135
+ - lib/duck_record/reflection.rb
136
+ - lib/duck_record/serialization.rb
137
+ - lib/duck_record/translation.rb
138
+ - lib/duck_record/type.rb
139
+ - lib/duck_record/type/array.rb
140
+ - lib/duck_record/type/array_without_blank.rb
141
+ - lib/duck_record/type/date.rb
142
+ - lib/duck_record/type/date_time.rb
143
+ - lib/duck_record/type/decimal_without_scale.rb
144
+ - lib/duck_record/type/internal/abstract_json.rb
145
+ - lib/duck_record/type/internal/timezone.rb
146
+ - lib/duck_record/type/json.rb
147
+ - lib/duck_record/type/registry.rb
148
+ - lib/duck_record/type/serialized.rb
149
+ - lib/duck_record/type/text.rb
150
+ - lib/duck_record/type/time.rb
151
+ - lib/duck_record/type/unsigned_integer.rb
152
+ - lib/duck_record/validations.rb
153
+ - lib/duck_record/validations/subset.rb
154
+ - lib/duck_record/validations/uniqueness_on_real_record.rb
155
+ - lib/duck_record/version.rb
156
+ - lib/tasks/acts_as_record_tasks.rake
157
+ homepage: https://github.com/tallty/duck_record
158
+ licenses:
159
+ - MIT
160
+ metadata: {}
161
+ post_install_message:
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: 2.2.2
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubyforge_project:
177
+ rubygems_version: 2.7.6
178
+ signing_key:
179
+ specification_version: 4
180
+ summary: Used for creating virtual models like ActiveType or ModelAttribute does
181
+ test_files: []