measured 2.8.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +11 -5
- data/.github/workflows/cla.yml +23 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +2 -0
- data/README.md +114 -4
- data/cache/volume.json +532 -0
- data/dev.yml +1 -2
- data/gemfiles/{activesupport-6.0.gemfile → rails-6.0.gemfile} +1 -0
- data/gemfiles/{activesupport-6.1.gemfile → rails-6.1.gemfile} +1 -0
- data/gemfiles/rails-7.0.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/volume.rb +2 -0
- data/lib/measured/units/weight.rb +1 -1
- 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/volume_test.rb +107 -1
- data/test/units/weight_test.rb +3 -1
- metadata +80 -7
- data/gemfiles/activesupport-5.2.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/volume_test.rb
CHANGED
@@ -19,6 +19,16 @@ class Measured::VolumeTest < ActiveSupport::TestCase
|
|
19
19
|
liters
|
20
20
|
litres
|
21
21
|
ft3
|
22
|
+
cm3
|
23
|
+
cubic_centimeter
|
24
|
+
cubic_centimeters
|
25
|
+
cubic_centimetre
|
26
|
+
cubic_centimetres
|
27
|
+
mm3
|
28
|
+
cubic_millimeter
|
29
|
+
cubic_millimeters
|
30
|
+
cubic_millimetre
|
31
|
+
cubic_millimetres
|
22
32
|
cubic_foot
|
23
33
|
cubic_feet
|
24
34
|
in3
|
@@ -67,7 +77,7 @@ class Measured::VolumeTest < ActiveSupport::TestCase
|
|
67
77
|
end
|
68
78
|
|
69
79
|
test ".unit_names should be the list of base unit names" do
|
70
|
-
expected_units = %w(l m3 ft3 in3 gal us_gal qt us_qt pt us_pt oz us_oz)
|
80
|
+
expected_units = %w(l m3 ft3 in3 gal us_gal qt us_qt pt us_pt oz us_oz mm3 cm3)
|
71
81
|
expected_units += Measured::UnitSystemBuilder::SI_PREFIXES.map { |short, _, _| "#{short}l" }
|
72
82
|
assert_equal expected_units.sort, Measured::Volume.unit_names
|
73
83
|
end
|
@@ -124,6 +134,102 @@ class Measured::VolumeTest < ActiveSupport::TestCase
|
|
124
134
|
test ".convert_to from us_oz to us_oz" do
|
125
135
|
assert_conversion Measured::Volume, "2000 us_oz", "2000 us_oz"
|
126
136
|
end
|
137
|
+
|
138
|
+
test ".convert_to from mm3 to mm3" do
|
139
|
+
assert_conversion Measured::Volume, "20000 mm3", "20000 mm3"
|
140
|
+
end
|
141
|
+
|
142
|
+
test ".convert_to from cm3 to cm3" do
|
143
|
+
assert_conversion Measured::Volume, "20000 cm3", "20000 cm3"
|
144
|
+
end
|
145
|
+
|
146
|
+
test ".convert_to from mm3 to m3" do
|
147
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.00002 m3"
|
148
|
+
end
|
149
|
+
|
150
|
+
test ".convert_to from mm3 to ft3" do
|
151
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.00070629333 ft3"
|
152
|
+
end
|
153
|
+
|
154
|
+
test ".convert_to from mm3 to in3" do
|
155
|
+
assert_conversion Measured::Volume, "20000 mm3", "1.2204749 in3"
|
156
|
+
end
|
157
|
+
|
158
|
+
test ".convert_to from mm3 to gal" do
|
159
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.004399384965981756 gal"
|
160
|
+
end
|
161
|
+
|
162
|
+
test ".convert_to from mm3 to us_gal" do
|
163
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.005283441047162969 us_gal"
|
164
|
+
end
|
165
|
+
|
166
|
+
test ".convert_to from mm3 to qt" do
|
167
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.01759754 qt"
|
168
|
+
end
|
169
|
+
|
170
|
+
test ".convert_to from mm3 to us_qt" do
|
171
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.021133764 us_qt"
|
172
|
+
end
|
173
|
+
|
174
|
+
test ".convert_to from mm3 to pt" do
|
175
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.03519508 pt"
|
176
|
+
end
|
177
|
+
|
178
|
+
test ".convert_to from mm3 to us_pt" do
|
179
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.042267528 us_pt"
|
180
|
+
end
|
181
|
+
|
182
|
+
test ".convert_to from mm3 to oz" do
|
183
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.70390159 oz"
|
184
|
+
end
|
185
|
+
|
186
|
+
test ".convert_to from mm3 to us_oz" do
|
187
|
+
assert_conversion Measured::Volume, "20000 mm3", "0.67628045 us_oz"
|
188
|
+
end
|
189
|
+
|
190
|
+
test ".convert_to from cm3 to m3" do
|
191
|
+
assert_conversion Measured::Volume, "20000 cm3", "0.02 m3"
|
192
|
+
end
|
193
|
+
|
194
|
+
test ".convert_to from cm3 to ft3" do
|
195
|
+
assert_conversion Measured::Volume, "20000 cm3", "0.70629333 ft3"
|
196
|
+
end
|
197
|
+
|
198
|
+
test ".convert_to from cm3 to in3" do
|
199
|
+
assert_conversion Measured::Volume, "20000 cm3", "1220.4748818946457 in3"
|
200
|
+
end
|
201
|
+
|
202
|
+
test ".convert_to from cm3 to gal" do
|
203
|
+
assert_conversion Measured::Volume, "20000 cm3", "4.399384965981756 gal"
|
204
|
+
end
|
205
|
+
|
206
|
+
test ".convert_to from cm3 to us_gal" do
|
207
|
+
assert_conversion Measured::Volume, "20000 cm3", "5.283441047162969 us_gal"
|
208
|
+
end
|
209
|
+
|
210
|
+
test ".convert_to from cm3 to qt" do
|
211
|
+
assert_conversion Measured::Volume, "20000 cm3", "17.59754 qt"
|
212
|
+
end
|
213
|
+
|
214
|
+
test ".convert_to from cm3 to us_qt" do
|
215
|
+
assert_conversion Measured::Volume, "20000 cm3", "21.133764 us_qt"
|
216
|
+
end
|
217
|
+
|
218
|
+
test ".convert_to from cm3 to pt" do
|
219
|
+
assert_conversion Measured::Volume, "20000 cm3", "35.19508 pt"
|
220
|
+
end
|
221
|
+
|
222
|
+
test ".convert_to from cm3 to us_pt" do
|
223
|
+
assert_conversion Measured::Volume, "20000 cm3", "42.267528 us_pt"
|
224
|
+
end
|
225
|
+
|
226
|
+
test ".convert_to from cm3 to oz" do
|
227
|
+
assert_conversion Measured::Volume, "20000 cm3", "703.9015945570809 oz"
|
228
|
+
end
|
229
|
+
|
230
|
+
test ".convert_to from cm3 to us_oz" do
|
231
|
+
assert_conversion Measured::Volume, "20000 cm3", "676.28045403686 us_oz"
|
232
|
+
end
|
127
233
|
|
128
234
|
test ".convert_to from ml to m3" do
|
129
235
|
assert_conversion Measured::Volume, "2000 ml", "0.002 m3"
|
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
|
@@ -39,7 +41,7 @@ class Measured::WeightTest < ActiveSupport::TestCase
|
|
39
41
|
weight_tons
|
40
42
|
)
|
41
43
|
expected_units += Measured::UnitSystemBuilder::SI_PREFIXES.flat_map do |short, long, _|
|
42
|
-
["#{short}g", "#{long}gram", "#{long}grams"]
|
44
|
+
["#{short}g", "#{long}gram", "#{long}grams", "#{long}gm", "#{long}gms"]
|
43
45
|
end
|
44
46
|
|
45
47
|
assert_equal expected_units.sort, Measured::Weight.unit_names_with_aliases
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: measured
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McPhillips
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-04-19 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:
|
@@ -105,7 +147,9 @@ extensions: []
|
|
105
147
|
extra_rdoc_files: []
|
106
148
|
files:
|
107
149
|
- ".github/workflows/ci.yml"
|
150
|
+
- ".github/workflows/cla.yml"
|
108
151
|
- ".gitignore"
|
152
|
+
- ".ruby-version"
|
109
153
|
- CHANGELOG.md
|
110
154
|
- Gemfile
|
111
155
|
- LICENSE
|
@@ -116,9 +160,10 @@ files:
|
|
116
160
|
- cache/volume.json
|
117
161
|
- cache/weight.json
|
118
162
|
- dev.yml
|
119
|
-
- gemfiles/
|
120
|
-
- gemfiles/
|
121
|
-
- gemfiles/
|
163
|
+
- gemfiles/rails-6.0.gemfile
|
164
|
+
- gemfiles/rails-6.1.gemfile
|
165
|
+
- gemfiles/rails-7.0.gemfile
|
166
|
+
- gemfiles/rails-edge.gemfile
|
122
167
|
- lib/measured.rb
|
123
168
|
- lib/measured/arithmetic.rb
|
124
169
|
- lib/measured/base.rb
|
@@ -130,6 +175,9 @@ files:
|
|
130
175
|
- lib/measured/measurable.rb
|
131
176
|
- lib/measured/missing_conversion_path.rb
|
132
177
|
- lib/measured/parser.rb
|
178
|
+
- lib/measured/rails/active_record.rb
|
179
|
+
- lib/measured/rails/validations.rb
|
180
|
+
- lib/measured/railtie.rb
|
133
181
|
- lib/measured/unit.rb
|
134
182
|
- lib/measured/unit_already_added.rb
|
135
183
|
- lib/measured/unit_error.rb
|
@@ -139,6 +187,7 @@ files:
|
|
139
187
|
- lib/measured/units/volume.rb
|
140
188
|
- lib/measured/units/weight.rb
|
141
189
|
- lib/measured/version.rb
|
190
|
+
- lib/tapioca/dsl/compilers/measured_rails.rb
|
142
191
|
- measured.gemspec
|
143
192
|
- shipit.rubygems.yml
|
144
193
|
- test/arithmetic_test.rb
|
@@ -147,11 +196,23 @@ files:
|
|
147
196
|
- test/cache/null_test.rb
|
148
197
|
- test/cache_consistency_test.rb
|
149
198
|
- test/conversion_table_builder_test.rb
|
199
|
+
- test/internal/app/models/thing.rb
|
200
|
+
- test/internal/app/models/thing_with_custom_unit_accessor.rb
|
201
|
+
- test/internal/app/models/thing_with_custom_value_accessor.rb
|
202
|
+
- test/internal/app/models/validated_thing.rb
|
203
|
+
- test/internal/config.ru
|
204
|
+
- test/internal/config/database.yml
|
205
|
+
- test/internal/db/.gitignore
|
206
|
+
- test/internal/db/schema.rb
|
207
|
+
- test/internal/log/.gitignore
|
150
208
|
- test/measurable_test.rb
|
151
209
|
- test/parser_test.rb
|
210
|
+
- test/rails/active_record_test.rb
|
211
|
+
- test/rails/validation_test.rb
|
152
212
|
- test/support/always_true_cache.rb
|
153
213
|
- test/support/fake_system.rb
|
154
214
|
- test/support/subclasses.rb
|
215
|
+
- test/tapioca/dsl/compilers/measured_rails_test.rb
|
155
216
|
- test/test_helper.rb
|
156
217
|
- test/unit_error_test.rb
|
157
218
|
- test/unit_system_builder_test.rb
|
@@ -173,14 +234,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
173
234
|
requirements:
|
174
235
|
- - ">="
|
175
236
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
237
|
+
version: 3.0.0
|
177
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
239
|
requirements:
|
179
240
|
- - ">="
|
180
241
|
- !ruby/object:Gem::Version
|
181
242
|
version: '0'
|
182
243
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
244
|
+
rubygems_version: 3.5.9
|
184
245
|
signing_key:
|
185
246
|
specification_version: 4
|
186
247
|
summary: Encapsulate measurements with their units in Ruby
|
@@ -191,11 +252,23 @@ test_files:
|
|
191
252
|
- test/cache/null_test.rb
|
192
253
|
- test/cache_consistency_test.rb
|
193
254
|
- test/conversion_table_builder_test.rb
|
255
|
+
- test/internal/app/models/thing.rb
|
256
|
+
- test/internal/app/models/thing_with_custom_unit_accessor.rb
|
257
|
+
- test/internal/app/models/thing_with_custom_value_accessor.rb
|
258
|
+
- test/internal/app/models/validated_thing.rb
|
259
|
+
- test/internal/config.ru
|
260
|
+
- test/internal/config/database.yml
|
261
|
+
- test/internal/db/.gitignore
|
262
|
+
- test/internal/db/schema.rb
|
263
|
+
- test/internal/log/.gitignore
|
194
264
|
- test/measurable_test.rb
|
195
265
|
- test/parser_test.rb
|
266
|
+
- test/rails/active_record_test.rb
|
267
|
+
- test/rails/validation_test.rb
|
196
268
|
- test/support/always_true_cache.rb
|
197
269
|
- test/support/fake_system.rb
|
198
270
|
- test/support/subclasses.rb
|
271
|
+
- test/tapioca/dsl/compilers/measured_rails_test.rb
|
199
272
|
- test/test_helper.rb
|
200
273
|
- test/unit_error_test.rb
|
201
274
|
- test/unit_system_builder_test.rb
|