Skip to content

Instantly share code, notes, and snippets.

@pocke
Created June 2, 2022 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pocke/578780f4be9d3ed14bce516d34cc1bce to your computer and use it in GitHub Desktop.
Save pocke/578780f4be9d3ed14bce516d34cc1bce to your computer and use it in GitHub Desktop.
require 'tmpdir'
require 'pathname'
Dir.mktmpdir('steep-playground-') do |dir|
dir = Pathname(dir)
dir.join('Steepfile').write(<<~END)
target :test do
signature "."
check "test.rb"
end
END
dir.join('test.rb').write(<<~END)
user = User.new(name: "John", age: 20)
user.test(user.name)
user.test(user.age)
END
dir.join('test.rbs').write(<<~END)
class User
def initialize: (name: String, age: Integer) -> void
attr_reader name: String
attr_reader age: Integer
def test: (String s) -> void
end
END
system('vim', '-O', 'test.rb', 'test.rbs', '-c', 'terminal', chdir: dir.to_s)
end
@pocke
Copy link
Author

pocke commented Jun 2, 2022

Screen.Recording.2022-06-02.at.16.42.48.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment