Sha256: 1b21e11465f044dd26faf96162a0d49b051117be1ca8b3cf5ac444278a929561

Contents?: true

Size: 731 Bytes

Versions: 23

Compression:

Stored size: 731 Bytes

Contents

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

  sig { override.params(root: Parlour::RbiGenerator::Namespace).void }
  def generate(root)
    model_assoc_proxy_class_rbi = root.create_class(self.model_assoc_proxy_class_name)

    # following methods only exists in an association proxy
    ["<<", "append", "push", "concat"].each do |method_name|
      elem = self.model_class_name
      model_assoc_proxy_class_rbi.create_method(
        method_name,
        parameters: [
          Parameter.new("*records", type: "T.any(#{elem}, T::Array[#{elem}])"),
        ],
        return_type: "T.self_type",
      )
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

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