Created
June 21, 2019 03:04
-
-
Save kunday/ae10ab770c12ac6c726ac8ea1dafae7c to your computer and use it in GitHub Desktop.
Sorbet: Type Annotations for Ruby
This file contains hidden or 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
| lib/rebootinator/executor/post_restart.rb:27: Method host does not exist on String https://srb.help/7003 | |
| 27 | @logger = data_store.host.logger | |
| ^^^^^^^^^^^^^^^ | |
| https://github.com/sorbet/sorbet/tree/cb98f48c8940783becf5a9037adcde734ba13bf4/rbi/core/string.rbi#L385: Did you mean: String#hash? | |
| 385 | def hash(); end | |
| ^^^^^^^^^^ | |
| Errors: 1 |
This file contains hidden or 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
| rebootinator [kunday/🍧●] % bundle exec srb tc | |
| No errors! Great job. |
This file contains hidden or 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
| rebootinator [kunday/🍧●] % bundle exec srb --help | |
| Unknown subcommand `--help` | |
| A type checker for Ruby | |
| Options: | |
| -h, --help View help for this subcommand. |
This file contains hidden or 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
| source "https://rubygems.org" | |
| # redacted gems | |
| gem 'sorbet', '~> 0.4.4263', group: :development | |
| gem 'sorbet-runtime' |
This file contains hidden or 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
| # typed: true | |
| # frozen_string_literal: true | |
| module Reboot | |
| class PreRestart | |
| include Dry::Monads::Result::Mixin | |
| extend T.sig | |
| # params intentionally set wrong to see an error message | |
| sig { params(data_store: String).returns(Rebootinator::Executor::PostRestart) } | |
| def initialize(data_store) | |
| @data_store = data_store | |
| @logger = data_store.host.logger | |
| end | |
| sig { returns(Dry::Monads::Result) } | |
| def execute | |
| # yield secret zendesk stuff | |
| end | |
| end | |
| end |
This file contains hidden or 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
| sig{params(data_store: Reboot::DataStore::Template).returns(Rebootinator::Executor::PostRestart)} | |
| def initialize(data_store) | |
| @data_store = data_store | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment