spoom icon indicating copy to clipboard operation
spoom copied to clipboard

Add command `spoom srb sigs translate` to translate RBI signatures into RBS comments

Open Morriar opened this issue 1 year ago • 0 comments

Consider the following file.rb:

# typed: strict

class Foo
  sig { returns(String) }
  attr_reader :x

  sig { params(x: String).void }
  def initialize(x)
    @x = x
  end
end

We can translate the RBI signatures it contains using the introduced Spoom command:

$ spoom srb sigs translate file.rb

Wich will update the file contents as follows:

# typed: strict

class Foo
  #: String
  attr_reader :x

  #: (String x) -> void
  def initialize(x)
    @x = x
  end
end

Morriar avatar Oct 03 '24 19:10 Morriar