model-to-schema 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +20 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +111 -0
- data/Rakefile +12 -0
- data/esquema.gemspec +38 -0
- data/lib/esquema/builder.rb +155 -0
- data/lib/esquema/configuration.rb +34 -0
- data/lib/esquema/keyword_validator.rb +98 -0
- data/lib/esquema/model.rb +31 -0
- data/lib/esquema/property.rb +238 -0
- data/lib/esquema/schema_enhancer.rb +90 -0
- data/lib/esquema/type_caster.rb +53 -0
- data/lib/esquema/version.rb +5 -0
- data/lib/esquema/virtual_column.rb +46 -0
- data/lib/esquema.rb +14 -0
- data/lib/generators/esquema/install/install_generator.rb +16 -0
- data/lib/generators/esquema/install/templates/esquema_initializer.rb +22 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/activemodel.rbi +89 -0
- data/sorbet/rbi/annotations/activerecord.rbi +92 -0
- data/sorbet/rbi/annotations/activesupport.rbi +421 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/activemodel@7.1.3.rbi +8 -0
- data/sorbet/rbi/gems/activerecord@7.1.3.rbi +8 -0
- data/sorbet/rbi/gems/activesupport@7.1.3.rbi +192 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +8 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.6.rbi +8 -0
- data/sorbet/rbi/gems/byebug@11.1.3.rbi +3606 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi +8 -0
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +8 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +1130 -0
- data/sorbet/rbi/gems/drb@2.2.0.rbi +1272 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
- data/sorbet/rbi/gems/i18n@1.14.1.rbi +8 -0
- data/sorbet/rbi/gems/json@2.7.1.rbi +1553 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
- data/sorbet/rbi/gems/minitest@5.22.2.rbi +8 -0
- data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +8 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/sorbet/rbi/gems/parallel@1.24.0.rbi +280 -0
- data/sorbet/rbi/gems/parser@3.3.0.5.rbi +5472 -0
- data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
- data/sorbet/rbi/gems/prism@0.24.0.rbi +31040 -0
- data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +1150 -0
- data/sorbet/rbi/gems/pry@0.14.2.rbi +10075 -0
- data/sorbet/rbi/gems/racc@1.7.3.rbi +157 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
- data/sorbet/rbi/gems/rake@13.1.0.rbi +3027 -0
- data/sorbet/rbi/gems/rbi@0.1.9.rbi +3006 -0
- data/sorbet/rbi/gems/regexp_parser@2.9.0.rbi +3771 -0
- data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
- data/sorbet/rbi/gems/rspec-core@3.13.0.rbi +10978 -0
- data/sorbet/rbi/gems/rspec-expectations@3.13.0.rbi +8153 -0
- data/sorbet/rbi/gems/rspec-mocks@3.13.0.rbi +5340 -0
- data/sorbet/rbi/gems/rspec-support@3.13.0.rbi +1629 -0
- data/sorbet/rbi/gems/rspec@3.13.0.rbi +82 -0
- data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +7006 -0
- data/sorbet/rbi/gems/rubocop@1.60.2.rbi +57383 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
- data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
- data/sorbet/rbi/gems/sqlite3@1.7.2.rbi +1691 -0
- data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23133 -0
- data/sorbet/rbi/gems/tapioca@0.12.0.rbi +3510 -0
- data/sorbet/rbi/gems/thor@1.3.0.rbi +4345 -0
- data/sorbet/rbi/gems/timeout@0.4.1.rbi +142 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +8 -0
- data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +65 -0
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
- data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
- data/sorbet/rbi/todo.rbi +20 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +176 -0
@@ -0,0 +1,192 @@
|
|
1
|
+
# typed: false
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `activesupport` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem activesupport`.
|
6
|
+
|
7
|
+
# :include: activesupport/README.rdoc
|
8
|
+
#
|
9
|
+
# source://activesupport//lib/active_support/concern.rb#3
|
10
|
+
module ActiveSupport; end
|
11
|
+
|
12
|
+
# = Active Support \Concern
|
13
|
+
#
|
14
|
+
# A typical module looks like this:
|
15
|
+
#
|
16
|
+
# module M
|
17
|
+
# def self.included(base)
|
18
|
+
# base.extend ClassMethods
|
19
|
+
# base.class_eval do
|
20
|
+
# scope :disabled, -> { where(disabled: true) }
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# module ClassMethods
|
25
|
+
# ...
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# By using +ActiveSupport::Concern+ the above module could instead be
|
30
|
+
# written as:
|
31
|
+
#
|
32
|
+
# require "active_support/concern"
|
33
|
+
#
|
34
|
+
# module M
|
35
|
+
# extend ActiveSupport::Concern
|
36
|
+
#
|
37
|
+
# included do
|
38
|
+
# scope :disabled, -> { where(disabled: true) }
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# class_methods do
|
42
|
+
# ...
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# Moreover, it gracefully handles module dependencies. Given a +Foo+ module
|
47
|
+
# and a +Bar+ module which depends on the former, we would typically write the
|
48
|
+
# following:
|
49
|
+
#
|
50
|
+
# module Foo
|
51
|
+
# def self.included(base)
|
52
|
+
# base.class_eval do
|
53
|
+
# def self.method_injected_by_foo
|
54
|
+
# ...
|
55
|
+
# end
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# module Bar
|
61
|
+
# def self.included(base)
|
62
|
+
# base.method_injected_by_foo
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# class Host
|
67
|
+
# include Foo # We need to include this dependency for Bar
|
68
|
+
# include Bar # Bar is the module that Host really needs
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We
|
72
|
+
# could try to hide these from +Host+ directly including +Foo+ in +Bar+:
|
73
|
+
#
|
74
|
+
# module Bar
|
75
|
+
# include Foo
|
76
|
+
# def self.included(base)
|
77
|
+
# base.method_injected_by_foo
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# class Host
|
82
|
+
# include Bar
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# Unfortunately this won't work, since when +Foo+ is included, its <tt>base</tt>
|
86
|
+
# is the +Bar+ module, not the +Host+ class. With +ActiveSupport::Concern+,
|
87
|
+
# module dependencies are properly resolved:
|
88
|
+
#
|
89
|
+
# require "active_support/concern"
|
90
|
+
#
|
91
|
+
# module Foo
|
92
|
+
# extend ActiveSupport::Concern
|
93
|
+
# included do
|
94
|
+
# def self.method_injected_by_foo
|
95
|
+
# ...
|
96
|
+
# end
|
97
|
+
# end
|
98
|
+
# end
|
99
|
+
#
|
100
|
+
# module Bar
|
101
|
+
# extend ActiveSupport::Concern
|
102
|
+
# include Foo
|
103
|
+
#
|
104
|
+
# included do
|
105
|
+
# self.method_injected_by_foo
|
106
|
+
# end
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# class Host
|
110
|
+
# include Bar # It works, now Bar takes care of its dependencies
|
111
|
+
# end
|
112
|
+
#
|
113
|
+
# === Prepending concerns
|
114
|
+
#
|
115
|
+
# Just like <tt>include</tt>, concerns also support <tt>prepend</tt> with a corresponding
|
116
|
+
# <tt>prepended do</tt> callback. <tt>module ClassMethods</tt> or <tt>class_methods do</tt> are
|
117
|
+
# prepended as well.
|
118
|
+
#
|
119
|
+
# <tt>prepend</tt> is also used for any dependencies.
|
120
|
+
#
|
121
|
+
# source://activesupport//lib/active_support/concern.rb#112
|
122
|
+
module ActiveSupport::Concern
|
123
|
+
# source://activesupport//lib/active_support/concern.rb#129
|
124
|
+
def append_features(base); end
|
125
|
+
|
126
|
+
# Define class methods from given block.
|
127
|
+
# You can define private class methods as well.
|
128
|
+
#
|
129
|
+
# module Example
|
130
|
+
# extend ActiveSupport::Concern
|
131
|
+
#
|
132
|
+
# class_methods do
|
133
|
+
# def foo; puts 'foo'; end
|
134
|
+
#
|
135
|
+
# private
|
136
|
+
# def bar; puts 'bar'; end
|
137
|
+
# end
|
138
|
+
# end
|
139
|
+
#
|
140
|
+
# class Buzz
|
141
|
+
# include Example
|
142
|
+
# end
|
143
|
+
#
|
144
|
+
# Buzz.foo # => "foo"
|
145
|
+
# Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError)
|
146
|
+
#
|
147
|
+
# source://activesupport//lib/active_support/concern.rb#209
|
148
|
+
def class_methods(&class_methods_module_definition); end
|
149
|
+
|
150
|
+
# Evaluate given block in context of base class,
|
151
|
+
# so that you can write class macros here.
|
152
|
+
# When you define more than one +included+ block, it raises an exception.
|
153
|
+
#
|
154
|
+
# source://activesupport//lib/active_support/concern.rb#158
|
155
|
+
def included(base = T.unsafe(nil), &block); end
|
156
|
+
|
157
|
+
# source://activesupport//lib/active_support/concern.rb#142
|
158
|
+
def prepend_features(base); end
|
159
|
+
|
160
|
+
# Evaluate given block in context of base class,
|
161
|
+
# so that you can write class macros here.
|
162
|
+
# When you define more than one +prepended+ block, it raises an exception.
|
163
|
+
#
|
164
|
+
# source://activesupport//lib/active_support/concern.rb#175
|
165
|
+
def prepended(base = T.unsafe(nil), &block); end
|
166
|
+
|
167
|
+
class << self
|
168
|
+
# source://activesupport//lib/active_support/concern.rb#125
|
169
|
+
def extended(base); end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# source://activesupport//lib/active_support/concern.rb#113
|
174
|
+
class ActiveSupport::Concern::MultipleIncludedBlocks < ::StandardError
|
175
|
+
# @return [MultipleIncludedBlocks] a new instance of MultipleIncludedBlocks
|
176
|
+
#
|
177
|
+
# source://activesupport//lib/active_support/concern.rb#114
|
178
|
+
def initialize; end
|
179
|
+
end
|
180
|
+
|
181
|
+
# source://activesupport//lib/active_support/concern.rb#119
|
182
|
+
class ActiveSupport::Concern::MultiplePrependBlocks < ::StandardError
|
183
|
+
# @return [MultiplePrependBlocks] a new instance of MultiplePrependBlocks
|
184
|
+
#
|
185
|
+
# source://activesupport//lib/active_support/concern.rb#120
|
186
|
+
def initialize; end
|
187
|
+
end
|
188
|
+
|
189
|
+
class NameError < ::StandardError
|
190
|
+
include ::ErrorHighlight::CoreExt
|
191
|
+
include ::DidYouMean::Correctable
|
192
|
+
end
|