Sha256: 445b448d3092ba1c1304ffa001a28b8e4593083a6d54e648af72624e18dd57ab

Contents?: true

Size: 1.23 KB

Versions: 26

Compression:

Stored size: 1.23 KB

Contents

# typed: strict
class ElasticSearchPlugin < SorbetRails::ModelPlugins::Base
  sig { override.params(root: Parlour::RbiGenerator::Namespace).void }
  def generate(root)
    return unless @model_class.include?(::Elasticsearch::Model)

    model_rbi = root.create_class(model_class_name)
    model_rbi.create_method(
      'mapping',
      class_method: true,
      parameters: [
        ::Parlour::RbiGenerator::Parameter.new(
          "options",
          type: "T.nilable(T::Hash[Symbol, T.untyped])", default: 'nil',
        ),
        ::Parlour::RbiGenerator::Parameter.new(
          "&block",
          type: "T.proc.bind(Elasticsearch::Model::Indexing::Mappings).void",
        )
      ],
      return_type: "Elasticsearch::Model::Indexing::Mappings",
    )

    model_rbi.create_method(
      'mappings',
      class_method: true,
      parameters: [
        ::Parlour::RbiGenerator::Parameter.new(
          "options",
          type: "T.nilable(T::Hash[Symbol, T.untyped])", default: 'nil',
        ),
        ::Parlour::RbiGenerator::Parameter.new(
          "&block",
          type: "T.proc.bind(Elasticsearch::Model::Indexing::Mappings).void",
        )
      ],
      return_type: "Elasticsearch::Model::Indexing::Mappings",
    )
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
sorbet-rails-0.6.5 lib/sorbet-rails/gem_plugins/elastic_search_plugin.rb
sorbet-rails-0.6.4 lib/sorbet-rails/gem_plugins/elastic_search_plugin.rb
sorbet-rails-0.6.3 lib/sorbet-rails/gem_plugins/elastic_search_plugin.rb
sorbet-rails-0.6.2 lib/sorbet-rails/gem_plugins/elastic_search_plugin.rb
sorbet-rails-0.6.1 lib/sorbet-rails/gem_plugins/elastic_search_plugin.rb
sorbet-rails-0.6.0 lib/sorbet-rails/gem_plugins/elastic_search_plugin.rb