arql 0.4.2 → 0.4.3
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/.vscode/launch.json +18 -2
 - data/Gemfile.lock +1 -1
 - data/lib/arql/definition.rb +14 -0
 - data/lib/arql/ext/active_record/base.rb +27 -0
 - data/lib/arql/version.rb +1 -1
 - data/lib/arql.rb +1 -0
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 27b435e716bd7f2f1a9a806508fd4542887ed3a21ba02355ec0c1a5476cd3c0e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 59b8a4267407fcafe2df3714e785fd971cde979cc533802b33b3709ea2bc893d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5493f7b368308e4e041c10f6562744bdb6ea47841959430c94e937b032f5d5fb44fbfc0d4217a9bc71b913fccdf70b4e23bd39f826bf47ec322a54223e2c34ab
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b73fd3af4bcfbefe0502f5e7d44ad1dfcea63d22e906199550d3a432a0858769445d3d3d5e155e854e244e761616fe15e390e054306b24206aaf72abe13e2760
         
     | 
    
        data/.vscode/launch.json
    CHANGED
    
    | 
         @@ -6,12 +6,15 @@ 
     | 
|
| 
       6 
6 
     | 
    
         
             
                "configurations": [
         
     | 
| 
       7 
7 
     | 
    
         
             
                    {
         
     | 
| 
       8 
8 
     | 
    
         
             
                        "type": "rdbg",
         
     | 
| 
       9 
     | 
    
         
            -
                        "name": "Debug  
     | 
| 
      
 9 
     | 
    
         
            +
                        "name": "Debug Arql",
         
     | 
| 
       10 
10 
     | 
    
         
             
                        "request": "launch",
         
     | 
| 
       11 
11 
     | 
    
         
             
                        "script": "exe/arql",
         
     | 
| 
       12 
12 
     | 
    
         
             
                        "command": "bundle exec",
         
     | 
| 
       13 
13 
     | 
    
         
             
                        "useTerminal": true,
         
     | 
| 
       14 
     | 
    
         
            -
                        "args": [ 
     | 
| 
      
 14 
     | 
    
         
            +
                        "args": [
         
     | 
| 
      
 15 
     | 
    
         
            +
                            "-e",
         
     | 
| 
      
 16 
     | 
    
         
            +
                            "${input:env}"
         
     | 
| 
      
 17 
     | 
    
         
            +
                        ],
         
     | 
| 
       15 
18 
     | 
    
         
             
                        "askParameters": false
         
     | 
| 
       16 
19 
     | 
    
         
             
                    },
         
     | 
| 
       17 
20 
     | 
    
         
             
                    {
         
     | 
| 
         @@ -19,5 +22,18 @@ 
     | 
|
| 
       19 
22 
     | 
    
         
             
                        "name": "Attach with rdbg",
         
     | 
| 
       20 
23 
     | 
    
         
             
                        "request": "attach"
         
     | 
| 
       21 
24 
     | 
    
         
             
                    }
         
     | 
| 
      
 25 
     | 
    
         
            +
                ],
         
     | 
| 
      
 26 
     | 
    
         
            +
                "inputs": [
         
     | 
| 
      
 27 
     | 
    
         
            +
                    {
         
     | 
| 
      
 28 
     | 
    
         
            +
                        "id": "env",
         
     | 
| 
      
 29 
     | 
    
         
            +
                        "type": "command",
         
     | 
| 
      
 30 
     | 
    
         
            +
                        "command": "extension.commandvariable.pickStringRemember",
         
     | 
| 
      
 31 
     | 
    
         
            +
                        "args": {
         
     | 
| 
      
 32 
     | 
    
         
            +
                            "fileName": "${userHome}/.arql.d/init.yml",
         
     | 
| 
      
 33 
     | 
    
         
            +
                            "pattern": {
         
     | 
| 
      
 34 
     | 
    
         
            +
                                "regexp": "^([\\w\\.]+):.*"
         
     | 
| 
      
 35 
     | 
    
         
            +
                            }
         
     | 
| 
      
 36 
     | 
    
         
            +
                        }
         
     | 
| 
      
 37 
     | 
    
         
            +
                    }
         
     | 
| 
       22 
38 
     | 
    
         
             
                ]
         
     | 
| 
       23 
39 
     | 
    
         
             
            }
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/arql/definition.rb
    CHANGED
    
    | 
         @@ -17,6 +17,20 @@ module Arql 
     | 
|
| 
       17 
17 
     | 
    
         
             
                    }
         
     | 
| 
       18 
18 
     | 
    
         
             
                  end.t
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                define_singleton_method(:like) do |**args|
         
     | 
| 
      
 22 
     | 
    
         
            +
                  send(:ransack, "#{args.keys.first}_cont" => args.values.first).result
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                def self.method_missing(method_name, *args, &block)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  if method_name.to_s =~ /^(.+)_like$/
         
     | 
| 
      
 27 
     | 
    
         
            +
                    attr_name = $1.to_sym
         
     | 
| 
      
 28 
     | 
    
         
            +
                    return super unless respond_to?(attr_name)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    send(:like, $1 => args.first)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  else
         
     | 
| 
      
 31 
     | 
    
         
            +
                    super
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
       20 
34 
     | 
    
         
             
              end
         
     | 
| 
       21 
35 
     | 
    
         | 
| 
       22 
36 
     | 
    
         
             
              class Definition
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Ransack
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Adapters
         
     | 
| 
      
 3 
     | 
    
         
            +
                module ActiveRecord
         
     | 
| 
      
 4 
     | 
    
         
            +
                  module Base
         
     | 
| 
      
 5 
     | 
    
         
            +
                    def ransack(params = {}, options = {})
         
     | 
| 
      
 6 
     | 
    
         
            +
                      old_base_connection = ::ActiveRecord::Base.method(:connection)
         
     | 
| 
      
 7 
     | 
    
         
            +
                      connection_obj = connection
         
     | 
| 
      
 8 
     | 
    
         
            +
                      ::ActiveRecord::Base.define_singleton_method(:connection) { connection_obj }
         
     | 
| 
      
 9 
     | 
    
         
            +
                      Search.new(self, params, options)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    ensure
         
     | 
| 
      
 11 
     | 
    
         
            +
                      ::ActiveRecord::Base.define_singleton_method(:connection, old_base_connection)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              class Search
         
     | 
| 
      
 18 
     | 
    
         
            +
                def result(opts = {})
         
     | 
| 
      
 19 
     | 
    
         
            +
                  old_base_connection = ::ActiveRecord::Base.method(:connection)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  connection_obj = @context.klass.connection
         
     | 
| 
      
 21 
     | 
    
         
            +
                  ::ActiveRecord::Base.define_singleton_method(:connection) { connection_obj }
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @context.evaluate(self, opts)
         
     | 
| 
      
 23 
     | 
    
         
            +
                ensure
         
     | 
| 
      
 24 
     | 
    
         
            +
                  ::ActiveRecord::Base.define_singleton_method(:connection, old_base_connection)
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/arql/version.rb
    CHANGED
    
    
    
        data/lib/arql.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: arql
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Liu Xiang
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-04-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: mysql2
         
     | 
| 
         @@ -340,6 +340,7 @@ files: 
     | 
|
| 
       340 
340 
     | 
    
         
             
            - lib/arql/concerns/table_data_definition.rb
         
     | 
| 
       341 
341 
     | 
    
         
             
            - lib/arql/definition.rb
         
     | 
| 
       342 
342 
     | 
    
         
             
            - lib/arql/ext.rb
         
     | 
| 
      
 343 
     | 
    
         
            +
            - lib/arql/ext/active_record/base.rb
         
     | 
| 
       343 
344 
     | 
    
         
             
            - lib/arql/ext/active_record/connection_adapters/abstract_mysql_adapter.rb
         
     | 
| 
       344 
345 
     | 
    
         
             
            - lib/arql/ext/active_record/connection_adapters/postgresql/schema_statements.rb
         
     | 
| 
       345 
346 
     | 
    
         
             
            - lib/arql/ext/active_record/relation.rb
         
     |