Sha256: b97d0456177317619b5404c1489103fa12a59f3c9061170eadaffbceff3bd0c5

Contents?: true

Size: 1.15 KB

Versions: 34

Compression:

Stored size: 1.15 KB

Contents

# typed: strict
require ('sorbet-rails/model_plugins/base')
class SorbetRails::ModelPlugins::ActiveRelationWhereNot < SorbetRails::ModelPlugins::Base

  sig { override.params(root: Parlour::RbiGenerator::Namespace).void }
  def generate(root)
    where_not_module_name = self.model_module_name("ActiveRelation_WhereNot")
    where_not_module_rbi = root.create_module(where_not_module_name)

    model_relation_class_rbi = root.create_class(self.model_relation_class_name)
    model_relation_class_rbi.create_include(where_not_module_name)

    model_assoc_relation_rbi = root.create_class(self.model_assoc_relation_class_name)
    model_assoc_relation_rbi.create_include(where_not_module_name)

    # TODO: where.not is a special case that we replace it with a `where_not` method
    # `where` when not given parameters will return a `ActiveRecord::QueryMethods::WhereChain`
    # instance that has a method `not` on it
    where_not_module_rbi.create_method(
      "not",
      parameters: [
        Parameter.new("opts", type: "T.untyped", default: nil),
        Parameter.new("*rest", type: "T.untyped", default: nil),
      ],
      return_type: "T.self_type",
    )
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
sorbet-rails-0.7.34 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.33 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.32 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.31 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.27 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.26 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.25 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.24 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.23 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.22 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.20 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.19 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.18 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.5 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.4 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.3 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.2 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.1 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.7.0 lib/sorbet-rails/model_plugins/active_relation_where_not.rb
sorbet-rails-0.6.5.1 lib/sorbet-rails/model_plugins/active_relation_where_not.rb