activegraph 11.2.0 → 11.3.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/CHANGELOG.md +16 -0
 - data/lib/active_graph/node/has_n.rb +6 -2
 - data/lib/active_graph/node/query/query_proxy.rb +8 -2
 - data/lib/active_graph/node/scope.rb +18 -8
 - data/lib/active_graph/relationship/related_node.rb +6 -2
 - data/lib/active_graph/shared/enum.rb +1 -1
 - data/lib/active_graph/tasks/migration.rake +5 -1
 - data/lib/active_graph/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a1ae9faa69f9792692e849f1d3de64c0a22b8e5623302cde0b1e707bfb443bba
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 57cb8e74aae28b60346bd7c908ed4e793df433c0722b3ab2322320d5a9bab217
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c5de6bb15067a8c93a14be2dd8949d70d0edcbc1bdabcab2c0880e11dda13f9bfcbdddc51c82438d7cd1642fafb841cbe6b03ca714d1633f3c8b09396531eb0c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 976b9fa40c5056de62e7dc9fc3437c107adf13b09f5d1b07b660b79f92f74c9434c18114e4bab1c16e845f529e145c4b337e461cf77b5a4f40d5255a9619103f
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. 
     | 
|
| 
       3 
3 
     | 
    
         
             
            This file should follow the standards specified on [http://keepachangelog.com/]
         
     | 
| 
       4 
4 
     | 
    
         
             
            This project adheres to [Semantic Versioning](http://semver.org/).
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
            ## [11.3.1] 2023-02-12
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Fixed
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            - Fixed an issue with keyword arguments on jruby-9.3 when none were passed
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ## [11.3.0] 2023-02-10
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ## Added
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            - support for keyword arguments in scopes
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ## Fixed
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            - Fixed issue with psych https://github.com/neo4jrb/activegraph/issues/1684 (Thanks @chytreg)
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       6 
22 
     | 
    
         
             
            ## [11.2.0] 2023-02-06
         
     | 
| 
       7 
23 
     | 
    
         | 
| 
       8 
24 
     | 
    
         
             
            ## Added
         
     | 
| 
         @@ -155,14 +155,18 @@ module ActiveGraph::Node 
     | 
|
| 
       155 
155 
     | 
    
         | 
| 
       156 
156 
     | 
    
         
             
                  CACHED_RESULT_METHODS = []
         
     | 
| 
       157 
157 
     | 
    
         | 
| 
       158 
     | 
    
         
            -
                  def method_missing(method_name, *args, &block)
         
     | 
| 
      
 158 
     | 
    
         
            +
                  def method_missing(method_name, *args, **kwargs, &block)
         
     | 
| 
       159 
159 
     | 
    
         
             
                    target = target_for_missing_method(method_name)
         
     | 
| 
       160 
160 
     | 
    
         
             
                    super if target.nil?
         
     | 
| 
       161 
161 
     | 
    
         | 
| 
       162 
162 
     | 
    
         
             
                    cache_query_proxy_result if !cached? && !target.is_a?(ActiveGraph::Node::Query::QueryProxy)
         
     | 
| 
       163 
163 
     | 
    
         
             
                    clear_cache_result if target.is_a?(ActiveGraph::Node::Query::QueryProxy)
         
     | 
| 
       164 
164 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
                     
     | 
| 
      
 165 
     | 
    
         
            +
                    if RUBY_VERSION < '3' && kwargs.empty?
         
     | 
| 
      
 166 
     | 
    
         
            +
                      target.public_send(method_name, *args, &block)
         
     | 
| 
      
 167 
     | 
    
         
            +
                    else
         
     | 
| 
      
 168 
     | 
    
         
            +
                      target.public_send(method_name, *args, **kwargs, &block)
         
     | 
| 
      
 169 
     | 
    
         
            +
                    end
         
     | 
| 
       166 
170 
     | 
    
         
             
                  end
         
     | 
| 
       167 
171 
     | 
    
         | 
| 
       168 
172 
     | 
    
         
             
                  def serializable_hash(options = {})
         
     | 
| 
         @@ -243,9 +243,15 @@ module ActiveGraph 
     | 
|
| 
       243 
243 
     | 
    
         | 
| 
       244 
244 
     | 
    
         
             
                    # QueryProxy objects act as a representation of a model at the class level so we pass through calls
         
     | 
| 
       245 
245 
     | 
    
         
             
                    # This allows us to define class functions for reusable query chaining or for end-of-query aggregation/summarizing
         
     | 
| 
       246 
     | 
    
         
            -
                    def method_missing(method_name, *args, &block)
         
     | 
| 
      
 246 
     | 
    
         
            +
                    def method_missing(method_name, *args, **kwargs, &block)
         
     | 
| 
       247 
247 
     | 
    
         
             
                      if @model && @model.respond_to?(method_name)
         
     | 
| 
       248 
     | 
    
         
            -
                        scoping  
     | 
| 
      
 248 
     | 
    
         
            +
                        scoping do
         
     | 
| 
      
 249 
     | 
    
         
            +
                          if RUBY_VERSION < '3' && kwargs.empty?
         
     | 
| 
      
 250 
     | 
    
         
            +
                            @model.public_send(method_name, *args, &block)
         
     | 
| 
      
 251 
     | 
    
         
            +
                          else
         
     | 
| 
      
 252 
     | 
    
         
            +
                            @model.public_send(method_name, *args, **kwargs, &block)
         
     | 
| 
      
 253 
     | 
    
         
            +
                          end
         
     | 
| 
      
 254 
     | 
    
         
            +
                        end
         
     | 
| 
       249 
255 
     | 
    
         
             
                      else
         
     | 
| 
       250 
256 
     | 
    
         
             
                        super
         
     | 
| 
       251 
257 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -39,15 +39,15 @@ module ActiveGraph::Node 
     | 
|
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                    klass = class << self; self; end
         
     | 
| 
       41 
41 
     | 
    
         
             
                    klass.instance_eval do
         
     | 
| 
       42 
     | 
    
         
            -
                      define_method(name) do |*query_params|
         
     | 
| 
      
 42 
     | 
    
         
            +
                      define_method(name) do |*query_params, **kwargs|
         
     | 
| 
       43 
43 
     | 
    
         
             
                        eval_context = ScopeEvalContext.new(self, current_scope || self.query_proxy)
         
     | 
| 
       44 
44 
     | 
    
         
             
                        proc = full_scopes[name.to_sym]
         
     | 
| 
       45 
     | 
    
         
            -
                        _call_scope_context(eval_context, query_params, proc)
         
     | 
| 
      
 45 
     | 
    
         
            +
                        _call_scope_context(eval_context, *query_params, **kwargs, &proc)
         
     | 
| 
       46 
46 
     | 
    
         
             
                      end
         
     | 
| 
       47 
47 
     | 
    
         
             
                    end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                    define_method(name) do |*query_params|
         
     | 
| 
       50 
     | 
    
         
            -
                      as(:n).public_send(name, *query_params)
         
     | 
| 
      
 49 
     | 
    
         
            +
                    define_method(name) do |*query_params, **kwargs|
         
     | 
| 
      
 50 
     | 
    
         
            +
                      as(:n).public_send(name, *query_params, **kwargs)
         
     | 
| 
       51 
51 
     | 
    
         
             
                    end
         
     | 
| 
       52 
52 
     | 
    
         
             
                  end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
         @@ -76,8 +76,14 @@ module ActiveGraph::Node 
     | 
|
| 
       76 
76 
     | 
    
         
             
                    end
         
     | 
| 
       77 
77 
     | 
    
         
             
                  end
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                  def _call_scope_context(eval_context, query_params, proc)
         
     | 
| 
       80 
     | 
    
         
            -
                     
     | 
| 
      
 79 
     | 
    
         
            +
                  def _call_scope_context(eval_context, *query_params, **kwargs, &proc)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    last_vararg_index = proc.arity - (kwargs.empty? ? 1 : 2)
         
     | 
| 
      
 81 
     | 
    
         
            +
                    query_params.fill(nil, query_params.length..last_vararg_index)
         
     | 
| 
      
 82 
     | 
    
         
            +
                    if RUBY_VERSION < '3' && kwargs.empty?
         
     | 
| 
      
 83 
     | 
    
         
            +
                      eval_context.instance_exec(*query_params, &proc)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    else
         
     | 
| 
      
 85 
     | 
    
         
            +
                      eval_context.instance_exec(*query_params, **kwargs, &proc)
         
     | 
| 
      
 86 
     | 
    
         
            +
                    end
         
     | 
| 
       81 
87 
     | 
    
         
             
                  end
         
     | 
| 
       82 
88 
     | 
    
         | 
| 
       83 
89 
     | 
    
         
             
                  def current_scope #:nodoc:
         
     | 
| 
         @@ -118,8 +124,12 @@ module ActiveGraph::Node 
     | 
|
| 
       118 
124 
     | 
    
         | 
| 
       119 
125 
     | 
    
         
             
                  # method_missing is not delegated to super class but to aggregated class
         
     | 
| 
       120 
126 
     | 
    
         
             
                  # rubocop:disable Style/MethodMissingSuper
         
     | 
| 
       121 
     | 
    
         
            -
                  def method_missing(name, *params, &block)
         
     | 
| 
       122 
     | 
    
         
            -
                     
     | 
| 
      
 127 
     | 
    
         
            +
                  def method_missing(name, *params, **kwargs, &block)
         
     | 
| 
      
 128 
     | 
    
         
            +
                    if RUBY_VERSION < '3' && kwargs.empty?
         
     | 
| 
      
 129 
     | 
    
         
            +
                      query_proxy_or_target.public_send(name, *params, &block)
         
     | 
| 
      
 130 
     | 
    
         
            +
                    else
         
     | 
| 
      
 131 
     | 
    
         
            +
                      query_proxy_or_target.public_send(name, *params, **kwargs, &block)
         
     | 
| 
      
 132 
     | 
    
         
            +
                    end
         
     | 
| 
       123 
133 
     | 
    
         
             
                  end
         
     | 
| 
       124 
134 
     | 
    
         
             
                  # rubocop:enable Style/MethodMissingSuper
         
     | 
| 
       125 
135 
     | 
    
         | 
| 
         @@ -61,8 +61,12 @@ module ActiveGraph::Relationship 
     | 
|
| 
       61 
61 
     | 
    
         
             
                  !@node.nil?
         
     | 
| 
       62 
62 
     | 
    
         
             
                end
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                def method_missing(*args, &block)
         
     | 
| 
       65 
     | 
    
         
            -
                   
     | 
| 
      
 64 
     | 
    
         
            +
                def method_missing(*args, **kwargs, &block)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  if RUBY_VERSION < '3' && kwargs.empty?
         
     | 
| 
      
 66 
     | 
    
         
            +
                    loaded.send(*args, &block)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  else
         
     | 
| 
      
 68 
     | 
    
         
            +
                    loaded.send(*args, **kwargs, &block)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
       66 
70 
     | 
    
         
             
                end
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
       68 
72 
     | 
    
         
             
                def respond_to_missing?(method_name, include_private = false)
         
     | 
| 
         @@ -41,7 +41,7 @@ module ActiveGraph::Shared 
     | 
|
| 
       41 
41 
     | 
    
         
             
                  #   Media.enum type: { image: 1, video: 2, unknown: 3 }
         
     | 
| 
       42 
42 
     | 
    
         
             
                  #
         
     | 
| 
       43 
43 
     | 
    
         
             
                  # @see http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html
         
     | 
| 
       44 
     | 
    
         
            -
                  def enum(parameters 
     | 
| 
      
 44 
     | 
    
         
            +
                  def enum(**parameters)
         
     | 
| 
       45 
45 
     | 
    
         
             
                    options, parameters = *split_options_and_parameters(parameters)
         
     | 
| 
       46 
46 
     | 
    
         
             
                    parameters.each do |property_name, enum_keys|
         
     | 
| 
       47 
47 
     | 
    
         
             
                      enum_keys = normalize_key_list enum_keys, options
         
     | 
| 
         @@ -83,7 +83,11 @@ COMMENT 
     | 
|
| 
       83 
83 
     | 
    
         | 
| 
       84 
84 
     | 
    
         
             
                  args.with_defaults(remove_missing: false)
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
     | 
    
         
            -
                  schema_data =  
     | 
| 
      
 86 
     | 
    
         
            +
                  schema_data = if Gem::Requirement.new('>= 4') =~ Gem::Version.new(Psych::VERSION)
         
     | 
| 
      
 87 
     | 
    
         
            +
                    YAML.safe_load(File.read(SCHEMA_YAML_PATH), permitted_classes: [Symbol])
         
     | 
| 
      
 88 
     | 
    
         
            +
                  else
         
     | 
| 
      
 89 
     | 
    
         
            +
                    YAML.safe_load(File.read(SCHEMA_YAML_PATH), [Symbol])
         
     | 
| 
      
 90 
     | 
    
         
            +
                  end
         
     | 
| 
       87 
91 
     | 
    
         | 
| 
       88 
92 
     | 
    
         
             
                  ActiveGraph::Base.subscribe_to_query(&method(:puts))
         
     | 
| 
       89 
93 
     | 
    
         | 
    
        data/lib/active_graph/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: activegraph
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 11. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 11.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-02-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activemodel
         
     | 
| 
         @@ -444,7 +444,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       444 
444 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       445 
445 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       446 
446 
     | 
    
         
             
            requirements: []
         
     | 
| 
       447 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 447 
     | 
    
         
            +
            rubygems_version: 3.3.26
         
     | 
| 
       448 
448 
     | 
    
         
             
            signing_key:
         
     | 
| 
       449 
449 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       450 
450 
     | 
    
         
             
            summary: A graph database for Ruby
         
     |