activerecord-refined 0.6.0 → 0.6.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/sandbox.yml +1 -0
- data/README.md +2 -2
- data/lib/active_record/refined/ast.rb +4 -0
- data/lib/activerecord-refined/version.rb +1 -1
- data/test/test_block_syntax.rb +27 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: affe44abbced76ea15b8c057f44292e5aefb0c8be7bc0012805278b08be7881c
|
|
4
|
+
data.tar.gz: 54b11073068080d169b005a4f2fdee825a8b03e0910459c5fef5555e24430edd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13103ed15da63fadedf60ec4f5f91ee0ba4c22440250aa9c7f48c9df2ccb0b72194225592ddf1dbca449d898fb33f5051fa30f906add9e533917c271b3b6283f
|
|
7
|
+
data.tar.gz: 97c9c10eeb67c3dbbbdd7e896e13eb4c49be50dd2312d92ee4289ab8a9c96d5159c06ea940f19a9871f33e877f71de8eb96c7d2d43399eb9097fd19505d4d35f
|
data/README.md
CHANGED
|
@@ -15,8 +15,8 @@ Author.
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
**[Try it in your browser](https://shugo.github.io/activerecord-refined/)** —
|
|
18
|
-
Ruby 4.1, ActiveRecord and
|
|
19
|
-
SQL and return real rows without a `ruby-master` build of your own.
|
|
18
|
+
Ruby 4.1, ActiveRecord, SQLite and PostgreSQL run in the page, so the examples
|
|
19
|
+
build real SQL and return real rows without a `ruby-master` build of your own.
|
|
20
20
|
|
|
21
21
|
## History
|
|
22
22
|
|
|
@@ -15,10 +15,14 @@ module ActiveRecord
|
|
|
15
15
|
# the mysql2 adapter and is counted with MySQL, though the two part
|
|
16
16
|
# company over JSON. An adapter nobody has classified keeps the
|
|
17
17
|
# standard spellings and is left to say for itself what it cannot do.
|
|
18
|
+
#
|
|
19
|
+
# pglite is PostgreSQL itself compiled to WebAssembly, reached through
|
|
20
|
+
# wasmify-rails' adapter; the server it answers for is the same one.
|
|
18
21
|
ADAPTER_FAMILIES = {
|
|
19
22
|
'sqlite3' => :sqlite,
|
|
20
23
|
'postgresql' => :postgresql,
|
|
21
24
|
'postgis' => :postgresql,
|
|
25
|
+
'pglite' => :postgresql,
|
|
22
26
|
'mysql2' => :mysql,
|
|
23
27
|
'trilogy' => :mysql,
|
|
24
28
|
}.freeze
|
data/test/test_block_syntax.rb
CHANGED
|
@@ -2228,4 +2228,31 @@ class TestBlockSyntax < Minitest::Test
|
|
|
2228
2228
|
def test_numeric_shorthand_is_confined_to_the_block
|
|
2229
2229
|
assert_raises(NoMethodError) { 0.as(:depth) }
|
|
2230
2230
|
end
|
|
2231
|
+
|
|
2232
|
+
# pglite is PostgreSQL compiled to WebAssembly, which the sandbox runs in the
|
|
2233
|
+
# browser. Its adapter answers to a name of its own, so without this the
|
|
2234
|
+
# spellings would fall back to the standard ones and the browser would be
|
|
2235
|
+
# told PostgreSQL's JSON operators do not exist.
|
|
2236
|
+
def test_adapter_families
|
|
2237
|
+
model = Class.new do
|
|
2238
|
+
def self.with_adapter(name)
|
|
2239
|
+
config = Struct.new(:adapter).new(name)
|
|
2240
|
+
Class.new { define_singleton_method(:connection_db_config) { config } }
|
|
2241
|
+
end
|
|
2242
|
+
end
|
|
2243
|
+
|
|
2244
|
+
{
|
|
2245
|
+
'sqlite3' => :sqlite,
|
|
2246
|
+
'postgresql' => :postgresql,
|
|
2247
|
+
'postgis' => :postgresql,
|
|
2248
|
+
'pglite' => :postgresql,
|
|
2249
|
+
'mysql2' => :mysql,
|
|
2250
|
+
'trilogy' => :mysql,
|
|
2251
|
+
'nothing_of_the_sort' => :unknown,
|
|
2252
|
+
}.each do |adapter, family|
|
|
2253
|
+
assert_equal(family,
|
|
2254
|
+
ActiveRecord::Refined::AST.adapter_family(model.with_adapter(adapter)),
|
|
2255
|
+
adapter)
|
|
2256
|
+
end
|
|
2257
|
+
end
|
|
2231
2258
|
end
|