measured 2.8.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +20 -0
- data/.github/workflows/ci.yml +12 -6
- data/.github/workflows/cla.yml +23 -0
- data/.github/workflows/dependabot_auto_merge.yml +93 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +2 -0
- data/README.md +114 -4
- data/cache/weight.json +230 -0
- data/dev.yml +1 -2
- data/gemfiles/rails-7.0.gemfile +6 -0
- data/gemfiles/rails-7.1.gemfile +6 -0
- data/gemfiles/rails-edge.gemfile +6 -0
- data/lib/measured/measurable.rb +3 -1
- data/lib/measured/rails/active_record.rb +130 -0
- data/lib/measured/rails/validations.rb +68 -0
- data/lib/measured/railtie.rb +12 -0
- data/lib/measured/units/weight.rb +3 -2
- data/lib/measured/version.rb +1 -1
- data/lib/measured.rb +2 -0
- data/lib/tapioca/dsl/compilers/measured_rails.rb +110 -0
- data/measured.gemspec +5 -0
- data/test/internal/app/models/thing.rb +14 -0
- data/test/internal/app/models/thing_with_custom_unit_accessor.rb +18 -0
- data/test/internal/app/models/thing_with_custom_value_accessor.rb +19 -0
- data/test/internal/app/models/validated_thing.rb +45 -0
- data/test/internal/config/database.yml +3 -0
- data/test/internal/config.ru +9 -0
- data/test/internal/db/.gitignore +1 -0
- data/test/internal/db/schema.rb +99 -0
- data/test/internal/log/.gitignore +1 -0
- data/test/measurable_test.rb +4 -0
- data/test/rails/active_record_test.rb +433 -0
- data/test/rails/validation_test.rb +252 -0
- data/test/tapioca/dsl/compilers/measured_rails_test.rb +220 -0
- data/test/test_helper.rb +15 -0
- data/test/units/weight_test.rb +77 -2
- metadata +84 -10
- data/gemfiles/activesupport-5.2.gemfile +0 -5
- data/gemfiles/activesupport-6.0.gemfile +0 -5
- data/gemfiles/activesupport-6.1.gemfile +0 -5
@@ -0,0 +1,220 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "test_helper"
|
5
|
+
require "tapioca/internal"
|
6
|
+
require "tapioca/helpers/test/dsl_compiler"
|
7
|
+
require "tapioca/dsl/compilers/measured_rails"
|
8
|
+
|
9
|
+
module Tapioca
|
10
|
+
module Dsl
|
11
|
+
module Compilers
|
12
|
+
class MeasuredRailsTest < ActiveSupport::TestCase
|
13
|
+
include Tapioca::Helpers::Test::DslCompiler
|
14
|
+
|
15
|
+
setup do
|
16
|
+
use_dsl_compiler(Tapioca::Dsl::Compilers::MeasuredRails)
|
17
|
+
end
|
18
|
+
|
19
|
+
test "#initialize gathers only ActiveRecord subclasses" do
|
20
|
+
add_ruby_file("content.rb", <<~RUBY)
|
21
|
+
class Post < ActiveRecord::Base
|
22
|
+
end
|
23
|
+
class Current
|
24
|
+
end
|
25
|
+
RUBY
|
26
|
+
|
27
|
+
assert_includes(gathered_constants, "Post")
|
28
|
+
refute_includes(gathered_constants, "Current")
|
29
|
+
end
|
30
|
+
|
31
|
+
test "generates empty RBI file if there are no measured fields" do
|
32
|
+
add_ruby_file("package.rb", <<~RUBY)
|
33
|
+
class Package < ActiveRecord::Base
|
34
|
+
end
|
35
|
+
RUBY
|
36
|
+
|
37
|
+
expected = <<~RBI
|
38
|
+
# typed: strong
|
39
|
+
RBI
|
40
|
+
|
41
|
+
assert_equal(expected, rbi_for(:Package))
|
42
|
+
end
|
43
|
+
|
44
|
+
test "generates RBI file for measured method" do
|
45
|
+
add_ruby_file("schema.rb", <<~RUBY)
|
46
|
+
ActiveRecord::Migration.suppress_messages do
|
47
|
+
ActiveRecord::Schema.define do
|
48
|
+
create_table :packages, force: :cascade do |t|
|
49
|
+
t.decimal :minimum_weight_value, precision: 10, scale: 2
|
50
|
+
t.string :minimum_weight_unit, limit: 12
|
51
|
+
t.decimal :total_length_value, precision: 10, scale: 2, default: 0
|
52
|
+
t.string :total_length_unit, limit: 12, default: "cm"
|
53
|
+
t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
|
54
|
+
t.string :total_volume_unit, limit: 12, default: "l"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
RUBY
|
59
|
+
|
60
|
+
add_ruby_file("package.rb", <<~RUBY)
|
61
|
+
class Package < ActiveRecord::Base
|
62
|
+
measured Measured::Weight, :minimum_weight
|
63
|
+
measured Measured::Length, :total_length
|
64
|
+
measured Measured::Volume, :total_volume
|
65
|
+
end
|
66
|
+
RUBY
|
67
|
+
|
68
|
+
expected = <<~RBI
|
69
|
+
# typed: strong
|
70
|
+
|
71
|
+
class Package
|
72
|
+
include GeneratedMeasuredRailsMethods
|
73
|
+
|
74
|
+
module GeneratedMeasuredRailsMethods
|
75
|
+
sig { returns(T.nilable(::Measured::Weight)) }
|
76
|
+
def minimum_weight; end
|
77
|
+
|
78
|
+
sig { params(value: T.nilable(::Measured::Weight)).void }
|
79
|
+
def minimum_weight=(value); end
|
80
|
+
|
81
|
+
sig { returns(T.nilable(::Measured::Length)) }
|
82
|
+
def total_length; end
|
83
|
+
|
84
|
+
sig { params(value: T.nilable(::Measured::Length)).void }
|
85
|
+
def total_length=(value); end
|
86
|
+
|
87
|
+
sig { returns(T.nilable(::Measured::Volume)) }
|
88
|
+
def total_volume; end
|
89
|
+
|
90
|
+
sig { params(value: T.nilable(::Measured::Volume)).void }
|
91
|
+
def total_volume=(value); end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
RBI
|
95
|
+
|
96
|
+
assert_equal(expected, rbi_for(:Package))
|
97
|
+
end
|
98
|
+
|
99
|
+
test "generates RBI file for measured_weight method" do
|
100
|
+
add_ruby_file("schema.rb", <<~RUBY)
|
101
|
+
ActiveRecord::Migration.suppress_messages do
|
102
|
+
ActiveRecord::Schema.define do
|
103
|
+
create_table :packages, force: :cascade do |t|
|
104
|
+
t.decimal :minimum_weight_value, precision: 10, scale: 2
|
105
|
+
t.string :minimum_weight_unit, limit: 12
|
106
|
+
t.decimal :total_length_value, precision: 10, scale: 2, default: 0
|
107
|
+
t.string :total_length_unit, limit: 12, default: "cm"
|
108
|
+
t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
|
109
|
+
t.string :total_volume_unit, limit: 12, default: "l"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
RUBY
|
114
|
+
|
115
|
+
add_ruby_file("package.rb", <<~RUBY)
|
116
|
+
class Package < ActiveRecord::Base
|
117
|
+
measured_weight :minimum_weight
|
118
|
+
end
|
119
|
+
RUBY
|
120
|
+
|
121
|
+
expected = <<~RBI
|
122
|
+
# typed: strong
|
123
|
+
|
124
|
+
class Package
|
125
|
+
include GeneratedMeasuredRailsMethods
|
126
|
+
|
127
|
+
module GeneratedMeasuredRailsMethods
|
128
|
+
sig { returns(T.nilable(::Measured::Weight)) }
|
129
|
+
def minimum_weight; end
|
130
|
+
|
131
|
+
sig { params(value: T.nilable(::Measured::Weight)).void }
|
132
|
+
def minimum_weight=(value); end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
RBI
|
136
|
+
|
137
|
+
assert_equal(expected, rbi_for(:Package))
|
138
|
+
end
|
139
|
+
|
140
|
+
test "generates RBI file for measured_length method" do
|
141
|
+
add_ruby_file("schema.rb", <<~RUBY)
|
142
|
+
ActiveRecord::Migration.suppress_messages do
|
143
|
+
ActiveRecord::Schema.define do
|
144
|
+
create_table :packages, force: :cascade do |t|
|
145
|
+
t.decimal :minimum_weight_value, precision: 10, scale: 2
|
146
|
+
t.string :minimum_weight_unit, limit: 12
|
147
|
+
t.decimal :total_length_value, precision: 10, scale: 2, default: 0
|
148
|
+
t.string :total_length_unit, limit: 12, default: "cm"
|
149
|
+
t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
|
150
|
+
t.string :total_volume_unit, limit: 12, default: "l"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
RUBY
|
155
|
+
|
156
|
+
add_ruby_file("package.rb", <<~RUBY)
|
157
|
+
class Package < ActiveRecord::Base
|
158
|
+
measured_length :total_length
|
159
|
+
end
|
160
|
+
RUBY
|
161
|
+
|
162
|
+
expected = <<~RBI
|
163
|
+
# typed: strong
|
164
|
+
|
165
|
+
class Package
|
166
|
+
include GeneratedMeasuredRailsMethods
|
167
|
+
|
168
|
+
module GeneratedMeasuredRailsMethods
|
169
|
+
sig { returns(T.nilable(::Measured::Length)) }
|
170
|
+
def total_length; end
|
171
|
+
|
172
|
+
sig { params(value: T.nilable(::Measured::Length)).void }
|
173
|
+
def total_length=(value); end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
RBI
|
177
|
+
|
178
|
+
assert_equal(expected, rbi_for(:Package))
|
179
|
+
end
|
180
|
+
|
181
|
+
test "generates RBI file for measured_volume method" do
|
182
|
+
add_ruby_file("schema.rb", <<~RUBY)
|
183
|
+
ActiveRecord::Migration.suppress_messages do
|
184
|
+
ActiveRecord::Schema.define do
|
185
|
+
create_table :packages, force: :cascade do |t|
|
186
|
+
t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
|
187
|
+
t.string :total_volume_unit, limit: 12, default: "l"
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
RUBY
|
192
|
+
|
193
|
+
add_ruby_file("package.rb", <<~RUBY)
|
194
|
+
class Package < ActiveRecord::Base
|
195
|
+
measured_volume :total_volume
|
196
|
+
end
|
197
|
+
RUBY
|
198
|
+
|
199
|
+
expected = <<~RBI
|
200
|
+
# typed: strong
|
201
|
+
|
202
|
+
class Package
|
203
|
+
include GeneratedMeasuredRailsMethods
|
204
|
+
|
205
|
+
module GeneratedMeasuredRailsMethods
|
206
|
+
sig { returns(T.nilable(::Measured::Volume)) }
|
207
|
+
def total_volume; end
|
208
|
+
|
209
|
+
sig { params(value: T.nilable(::Measured::Volume)).void }
|
210
|
+
def total_volume=(value); end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
RBI
|
214
|
+
|
215
|
+
assert_equal(expected, rbi_for(:Package))
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "pry" unless ENV["CI"]
|
4
|
+
require "combustion"
|
5
|
+
Combustion.path = "test/internal"
|
6
|
+
Combustion.initialize! :active_record, :active_model
|
3
7
|
require "measured"
|
4
8
|
require "minitest/reporters"
|
5
9
|
require "minitest/autorun"
|
@@ -7,6 +11,13 @@ require "mocha/minitest"
|
|
7
11
|
|
8
12
|
ActiveSupport.test_order = :random
|
9
13
|
|
14
|
+
# Prevent two reporters from printing
|
15
|
+
# https://github.com/kern/minitest-reporters/issues/230
|
16
|
+
# https://github.com/rails/rails/issues/30491
|
17
|
+
Minitest.load_plugins
|
18
|
+
Minitest.extensions.delete('rails')
|
19
|
+
Minitest.extensions.unshift('rails')
|
20
|
+
|
10
21
|
Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new(color: true)]
|
11
22
|
|
12
23
|
require "support/subclasses"
|
@@ -44,4 +55,8 @@ class ActiveSupport::TestCase
|
|
44
55
|
error = assert_raise(exception) { yield }
|
45
56
|
assert_equal expected_message, error.message, "Exception #{exception} raised but messages are not equal"
|
46
57
|
end
|
58
|
+
|
59
|
+
def reset_db
|
60
|
+
Combustion::Database::LoadSchema.call
|
61
|
+
end
|
47
62
|
end
|
data/test/units/weight_test.rb
CHANGED
@@ -15,6 +15,8 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
15
15
|
g
|
16
16
|
gram
|
17
17
|
grams
|
18
|
+
gm
|
19
|
+
gms
|
18
20
|
imperial_ton
|
19
21
|
imperial_tons
|
20
22
|
lb
|
@@ -23,6 +25,11 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
23
25
|
long_tons
|
24
26
|
metric_ton
|
25
27
|
metric_tons
|
28
|
+
tonne
|
29
|
+
tonnes
|
30
|
+
q
|
31
|
+
quintal
|
32
|
+
quintals
|
26
33
|
newton
|
27
34
|
newtons
|
28
35
|
ounce
|
@@ -39,14 +46,14 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
39
46
|
weight_tons
|
40
47
|
)
|
41
48
|
expected_units += Measured::UnitSystemBuilder::SI_PREFIXES.flat_map do |short, long, _|
|
42
|
-
["#{short}g", "#{long}gram", "#{long}grams"]
|
49
|
+
["#{short}g", "#{long}gram", "#{long}grams", "#{long}gm", "#{long}gms"]
|
43
50
|
end
|
44
51
|
|
45
52
|
assert_equal expected_units.sort, Measured::Weight.unit_names_with_aliases
|
46
53
|
end
|
47
54
|
|
48
55
|
test ".unit_names should be the list of base unit names" do
|
49
|
-
expected_units = %w(N g lb long_ton oz short_ton slug t)
|
56
|
+
expected_units = %w(N g lb long_ton oz short_ton slug t q)
|
50
57
|
expected_units += Measured::UnitSystemBuilder::SI_PREFIXES.map { |short, _, _| "#{short}g" }
|
51
58
|
assert_equal expected_units.sort, Measured::Weight.unit_names
|
52
59
|
end
|
@@ -96,6 +103,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
96
103
|
assert_exact_conversion Measured::Weight, "2000 g", "0.002 t"
|
97
104
|
end
|
98
105
|
|
106
|
+
test ".convert_to from g to q" do
|
107
|
+
assert_exact_conversion Measured::Weight, "2000 g", "0.02 q"
|
108
|
+
end
|
109
|
+
|
99
110
|
test ".convert_to from kg to g" do
|
100
111
|
assert_exact_conversion Measured::Weight, "2000 kg", "2000000 g"
|
101
112
|
end
|
@@ -132,6 +143,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
132
143
|
assert_exact_conversion Measured::Weight, "2000 kg", "2 t"
|
133
144
|
end
|
134
145
|
|
146
|
+
test ".convert_to from kg to q" do
|
147
|
+
assert_exact_conversion Measured::Weight, "2000 kg", "20 q"
|
148
|
+
end
|
149
|
+
|
135
150
|
test ".convert_to from lb to g" do
|
136
151
|
assert_exact_conversion Measured::Weight, "2000 lb", "907184.74 g"
|
137
152
|
end
|
@@ -168,6 +183,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
168
183
|
assert_conversion Measured::Weight, "2000 lb", "0.90718474 t"
|
169
184
|
end
|
170
185
|
|
186
|
+
test ".convert_to from lb to q" do
|
187
|
+
assert_conversion Measured::Weight, "2000 lb", "9.0718474 q"
|
188
|
+
end
|
189
|
+
|
171
190
|
test ".convert_to from oz to g" do
|
172
191
|
assert_conversion Measured::Weight, "2000 oz", "56699.04625 g"
|
173
192
|
end
|
@@ -204,6 +223,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
204
223
|
assert_conversion Measured::Weight, "2000 oz", "0.05669904625 t"
|
205
224
|
end
|
206
225
|
|
226
|
+
test ".convert_to from oz to q" do
|
227
|
+
assert_conversion Measured::Weight, "2000 oz", "0.5669904625 q"
|
228
|
+
end
|
229
|
+
|
207
230
|
test ".convert_to from slug to g" do
|
208
231
|
assert_conversion Measured::Weight, "2000 slug", "29187806 g"
|
209
232
|
end
|
@@ -240,6 +263,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
240
263
|
assert_conversion Measured::Weight, "2000 slug", "29.187806 t"
|
241
264
|
end
|
242
265
|
|
266
|
+
test ".convert_to from slug to q" do
|
267
|
+
assert_conversion Measured::Weight, "2000 slug", "291.87806 q"
|
268
|
+
end
|
269
|
+
|
243
270
|
test ".convert_to from short_ton to g" do
|
244
271
|
assert_conversion Measured::Weight, "2000 short_ton", "1814369480 g"
|
245
272
|
end
|
@@ -276,6 +303,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
276
303
|
assert_conversion Measured::Weight, "2000 short_ton", "1814.36948 t"
|
277
304
|
end
|
278
305
|
|
306
|
+
test ".convert_to from short_ton to q" do
|
307
|
+
assert_conversion Measured::Weight, "2000 short_ton", "18143.6948 q"
|
308
|
+
end
|
309
|
+
|
279
310
|
test ".convert_to from long_ton to g" do
|
280
311
|
assert_conversion Measured::Weight, "2000 long_ton", "2032093817.6 g"
|
281
312
|
end
|
@@ -312,6 +343,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
312
343
|
assert_conversion Measured::Weight, "2000 long_ton", "2032.0938176 t"
|
313
344
|
end
|
314
345
|
|
346
|
+
test ".convert_to from long_ton to q" do
|
347
|
+
assert_conversion Measured::Weight, "2000 long_ton", "20320.938176 q"
|
348
|
+
end
|
349
|
+
|
315
350
|
test ".convert_to from N to g" do
|
316
351
|
assert_conversion Measured::Weight, "2000 N", "203943.24259558567 g"
|
317
352
|
end
|
@@ -348,6 +383,10 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
348
383
|
assert_conversion Measured::Weight, "2000 N", "0.2039432425955857 t"
|
349
384
|
end
|
350
385
|
|
386
|
+
test ".convert_to from N to q" do
|
387
|
+
assert_conversion Measured::Weight, "2000 N", "2.039432425955857 q"
|
388
|
+
end
|
389
|
+
|
351
390
|
test ".convert_to from t to g" do
|
352
391
|
assert_exact_conversion Measured::Weight, "2000 t", "2000000000 g"
|
353
392
|
end
|
@@ -375,4 +414,40 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
375
414
|
test ".convert_to from t to t" do
|
376
415
|
assert_conversion Measured::Weight, "2000 t", "2000 t"
|
377
416
|
end
|
417
|
+
|
418
|
+
test ".convert_to from t to q" do
|
419
|
+
assert_conversion Measured::Weight, "2000 t", "20000 q"
|
420
|
+
end
|
421
|
+
|
422
|
+
test ".convert_to from q to g" do
|
423
|
+
assert_exact_conversion Measured::Weight, "2000 q", "200000000 g"
|
424
|
+
end
|
425
|
+
|
426
|
+
test ".convert_to from q to kg" do
|
427
|
+
assert_exact_conversion Measured::Weight, "2000 q", "200000 kg"
|
428
|
+
end
|
429
|
+
|
430
|
+
test ".convert_to from q to lb" do
|
431
|
+
assert_conversion Measured::Weight, "2000 q", "440924.5243697552 lb"
|
432
|
+
end
|
433
|
+
|
434
|
+
test ".convert_to from q to oz" do
|
435
|
+
assert_conversion Measured::Weight, "2000 q", "7054792.389916082 oz"
|
436
|
+
end
|
437
|
+
|
438
|
+
test ".convert_to from q to slug" do
|
439
|
+
assert_conversion Measured::Weight, "2000 q", "13704.35311239221 slug"
|
440
|
+
end
|
441
|
+
|
442
|
+
test ".convert_to from q to short_ton" do
|
443
|
+
assert_conversion Measured::Weight, "2000 q", "220.4622621848 short_ton"
|
444
|
+
end
|
445
|
+
|
446
|
+
test ".convert_to from q to t" do
|
447
|
+
assert_conversion Measured::Weight, "2000 q", "200 t"
|
448
|
+
end
|
449
|
+
|
450
|
+
test ".convert_to from q to q" do
|
451
|
+
assert_conversion Measured::Weight, "2000 q", "2000 q"
|
452
|
+
end
|
378
453
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: measured
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McPhillips
|
8
8
|
- Jason Gedge
|
9
9
|
- Javier Honduvilla Coto
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -96,6 +96,48 @@ dependencies:
|
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: combustion
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: sqlite3
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '1.4'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '1.4'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: tapioca
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
99
141
|
description: Wrapper objects which encapsulate measurements and their associated units
|
100
142
|
in Ruby.
|
101
143
|
email:
|
@@ -104,8 +146,12 @@ executables: []
|
|
104
146
|
extensions: []
|
105
147
|
extra_rdoc_files: []
|
106
148
|
files:
|
149
|
+
- ".github/dependabot.yml"
|
107
150
|
- ".github/workflows/ci.yml"
|
151
|
+
- ".github/workflows/cla.yml"
|
152
|
+
- ".github/workflows/dependabot_auto_merge.yml"
|
108
153
|
- ".gitignore"
|
154
|
+
- ".ruby-version"
|
109
155
|
- CHANGELOG.md
|
110
156
|
- Gemfile
|
111
157
|
- LICENSE
|
@@ -116,9 +162,9 @@ files:
|
|
116
162
|
- cache/volume.json
|
117
163
|
- cache/weight.json
|
118
164
|
- dev.yml
|
119
|
-
- gemfiles/
|
120
|
-
- gemfiles/
|
121
|
-
- gemfiles/
|
165
|
+
- gemfiles/rails-7.0.gemfile
|
166
|
+
- gemfiles/rails-7.1.gemfile
|
167
|
+
- gemfiles/rails-edge.gemfile
|
122
168
|
- lib/measured.rb
|
123
169
|
- lib/measured/arithmetic.rb
|
124
170
|
- lib/measured/base.rb
|
@@ -130,6 +176,9 @@ files:
|
|
130
176
|
- lib/measured/measurable.rb
|
131
177
|
- lib/measured/missing_conversion_path.rb
|
132
178
|
- lib/measured/parser.rb
|
179
|
+
- lib/measured/rails/active_record.rb
|
180
|
+
- lib/measured/rails/validations.rb
|
181
|
+
- lib/measured/railtie.rb
|
133
182
|
- lib/measured/unit.rb
|
134
183
|
- lib/measured/unit_already_added.rb
|
135
184
|
- lib/measured/unit_error.rb
|
@@ -139,6 +188,7 @@ files:
|
|
139
188
|
- lib/measured/units/volume.rb
|
140
189
|
- lib/measured/units/weight.rb
|
141
190
|
- lib/measured/version.rb
|
191
|
+
- lib/tapioca/dsl/compilers/measured_rails.rb
|
142
192
|
- measured.gemspec
|
143
193
|
- shipit.rubygems.yml
|
144
194
|
- test/arithmetic_test.rb
|
@@ -147,11 +197,23 @@ files:
|
|
147
197
|
- test/cache/null_test.rb
|
148
198
|
- test/cache_consistency_test.rb
|
149
199
|
- test/conversion_table_builder_test.rb
|
200
|
+
- test/internal/app/models/thing.rb
|
201
|
+
- test/internal/app/models/thing_with_custom_unit_accessor.rb
|
202
|
+
- test/internal/app/models/thing_with_custom_value_accessor.rb
|
203
|
+
- test/internal/app/models/validated_thing.rb
|
204
|
+
- test/internal/config.ru
|
205
|
+
- test/internal/config/database.yml
|
206
|
+
- test/internal/db/.gitignore
|
207
|
+
- test/internal/db/schema.rb
|
208
|
+
- test/internal/log/.gitignore
|
150
209
|
- test/measurable_test.rb
|
151
210
|
- test/parser_test.rb
|
211
|
+
- test/rails/active_record_test.rb
|
212
|
+
- test/rails/validation_test.rb
|
152
213
|
- test/support/always_true_cache.rb
|
153
214
|
- test/support/fake_system.rb
|
154
215
|
- test/support/subclasses.rb
|
216
|
+
- test/tapioca/dsl/compilers/measured_rails_test.rb
|
155
217
|
- test/test_helper.rb
|
156
218
|
- test/unit_error_test.rb
|
157
219
|
- test/unit_system_builder_test.rb
|
@@ -165,7 +227,7 @@ licenses:
|
|
165
227
|
- MIT
|
166
228
|
metadata:
|
167
229
|
allowed_push_host: https://rubygems.org
|
168
|
-
post_install_message:
|
230
|
+
post_install_message:
|
169
231
|
rdoc_options: []
|
170
232
|
require_paths:
|
171
233
|
- lib
|
@@ -173,15 +235,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
173
235
|
requirements:
|
174
236
|
- - ">="
|
175
237
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
238
|
+
version: 3.0.0
|
177
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
240
|
requirements:
|
179
241
|
- - ">="
|
180
242
|
- !ruby/object:Gem::Version
|
181
243
|
version: '0'
|
182
244
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
184
|
-
signing_key:
|
245
|
+
rubygems_version: 3.5.20
|
246
|
+
signing_key:
|
185
247
|
specification_version: 4
|
186
248
|
summary: Encapsulate measurements with their units in Ruby
|
187
249
|
test_files:
|
@@ -191,11 +253,23 @@ test_files:
|
|
191
253
|
- test/cache/null_test.rb
|
192
254
|
- test/cache_consistency_test.rb
|
193
255
|
- test/conversion_table_builder_test.rb
|
256
|
+
- test/internal/app/models/thing.rb
|
257
|
+
- test/internal/app/models/thing_with_custom_unit_accessor.rb
|
258
|
+
- test/internal/app/models/thing_with_custom_value_accessor.rb
|
259
|
+
- test/internal/app/models/validated_thing.rb
|
260
|
+
- test/internal/config.ru
|
261
|
+
- test/internal/config/database.yml
|
262
|
+
- test/internal/db/.gitignore
|
263
|
+
- test/internal/db/schema.rb
|
264
|
+
- test/internal/log/.gitignore
|
194
265
|
- test/measurable_test.rb
|
195
266
|
- test/parser_test.rb
|
267
|
+
- test/rails/active_record_test.rb
|
268
|
+
- test/rails/validation_test.rb
|
196
269
|
- test/support/always_true_cache.rb
|
197
270
|
- test/support/fake_system.rb
|
198
271
|
- test/support/subclasses.rb
|
272
|
+
- test/tapioca/dsl/compilers/measured_rails_test.rb
|
199
273
|
- test/test_helper.rb
|
200
274
|
- test/unit_error_test.rb
|
201
275
|
- test/unit_system_builder_test.rb
|