Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sinatra gem type #562

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions gems/sinatra/4.0/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ def bar
json(foo: foo, bar: bar)
end

get '/test_params/:id' do
params[:id]
params['id']
json(status: 'ok')
end

get '/fail' do
halt 500
end

post '/' do
json(foo: foo, bar: bar)
end
Expand Down
3 changes: 3 additions & 0 deletions gems/sinatra/4.0/base.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,14 @@ module Sinatra
attr_accessor app: untyped

attr_accessor env: Hash[String, untyped]
def self.env: () -> Hash[String, untyped]

attr_accessor request: untyped

attr_accessor response: untyped

attr_accessor params: IndifferentHash
def self.params: () -> IndifferentHash

attr_reader template_cache: untyped

Expand All @@ -486,6 +488,7 @@ module Sinatra
# Exit the current block, halts any further processing
# of the request, and returns the specified response.
def halt: (*untyped response) -> untyped
def self.halt: (*untyped response) -> untyped

# Pass control to the next matching route.
# If there are no more matching routes, Sinatra will
Expand Down