Skip to content

Instantly share code, notes, and snippets.

@jb08
Last active November 12, 2021 03:14
Show Gist options
  • Save jb08/3e60361485167f3c88000f183ae5ebff to your computer and use it in GitHub Desktop.
Save jb08/3e60361485167f3c88000f183ae5ebff to your computer and use it in GitHub Desktop.
ruby tool examples
## Sorbet
# typed: true
extend T::Sig
sig {params(name: String).returns(Integer)}
def main(name)
puts "Hello, #{name}!"
name.length
end
main("Sorbet") #=> ok!
main() #=> error: Not enough arguments provided
## Typeprof
$ typeprof test.rb
class Object
def foo : (Integer) -> String?
end
## Rswag
path '/blogs/{id}' do
get 'Retrieves a blog' do
tags 'Blogs', 'Another Tag'
produces 'application/json', 'application/xml'
parameter name: :id, in: :path, type: :string
...
end
end
## https://github.com/sorbet
## https://github.com/ruby/typeprof
## https://github.com/rswag/rswag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment