Last active
November 12, 2021 03:14
-
-
Save jb08/3e60361485167f3c88000f183ae5ebff to your computer and use it in GitHub Desktop.
ruby tool examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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