Sha256: 03fcef2ecb37ecc5fc7504732e3ea26a9ff5d67efbcd16e2f06655a95e85a81f

Contents?: true

Size: 1.74 KB

Versions: 5

Compression:

Stored size: 1.74 KB

Contents

# typed: strict
# frozen_string_literal: true

module Tapioca
  module Compilers
    module Dsl
      module ParamHelper
        extend T::Sig

        sig { params(name: String, type: String).returns(RBI::TypedParam) }
        def create_param(name, type:)
          create_typed_param(RBI::Param.new(name), type)
        end

        sig { params(name: String, type: String, default: String).returns(RBI::TypedParam) }
        def create_opt_param(name, type:, default:)
          create_typed_param(RBI::OptParam.new(name, default), type)
        end

        sig { params(name: String, type: String).returns(RBI::TypedParam) }
        def create_rest_param(name, type:)
          create_typed_param(RBI::RestParam.new(name), type)
        end

        sig { params(name: String, type: String).returns(RBI::TypedParam) }
        def create_kw_param(name, type:)
          create_typed_param(RBI::KwParam.new(name), type)
        end

        sig { params(name: String, type: String, default: String).returns(RBI::TypedParam) }
        def create_kw_opt_param(name, type:, default:)
          create_typed_param(RBI::KwOptParam.new(name, default), type)
        end

        sig { params(name: String, type: String).returns(RBI::TypedParam) }
        def create_kw_rest_param(name, type:)
          create_typed_param(RBI::KwRestParam.new(name), type)
        end

        sig { params(name: String, type: String).returns(RBI::TypedParam) }
        def create_block_param(name, type:)
          create_typed_param(RBI::BlockParam.new(name), type)
        end

        sig { params(param: RBI::Param, type: String).returns(RBI::TypedParam) }
        def create_typed_param(param, type)
          RBI::TypedParam.new(param: param, type: type)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tapioca-0.6.4 lib/tapioca/compilers/dsl/param_helper.rb
tapioca-0.6.3 lib/tapioca/compilers/dsl/param_helper.rb
tapioca-0.6.2 lib/tapioca/compilers/dsl/param_helper.rb
tapioca-0.6.1 lib/tapioca/compilers/dsl/param_helper.rb
tapioca-0.6.0 lib/tapioca/compilers/dsl/param_helper.rb