Skip to content

Instantly share code, notes, and snippets.

@kunday
Created June 21, 2019 03:04
Show Gist options
  • Select an option

  • Save kunday/ae10ab770c12ac6c726ac8ea1dafae7c to your computer and use it in GitHub Desktop.

Select an option

Save kunday/ae10ab770c12ac6c726ac8ea1dafae7c to your computer and use it in GitHub Desktop.
Sorbet: Type Annotations for Ruby
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
rebootinator [kunday/🍧●] % bundle exec srb tc
No errors! Great job.
rebootinator [kunday/🍧●] % bundle exec srb --help
Unknown subcommand `--help`
A type checker for Ruby
Options:
-h, --help View help for this subcommand.
source "https://rubygems.org"
# redacted gems
gem 'sorbet', '~> 0.4.4263', group: :development
gem 'sorbet-runtime'
# 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
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