Skip to content

Cannot translate rbi to rbs if there is a keyword before def #777

@pvcresin

Description

@pvcresin

Describe the bug

Cannot translate rbi to rbs if there is a keyword such as public before def.

#: () -> String 
public def bar = 'bar'

To Reproduce
Spoom version: '1.7.4'

example.rb: before

class Example
  #: () -> String
  public def bar = 'bar'
end

Steps to reproduce the behavior:

  1. bundle exec spoom srb sigs translate --from rbs --to rbi example.rb
  2. Nothing changes.

Expected behavior

example.rb: after(expected)

class Example
  sig { returns(String) }
  public def bar = 'bar'
end

Additional Information

We use a gem called alt_memery for memoizing.

When using this one, we would be happy if we could support the same, since the keyword memoize comes before def as follows.

#: () -> String 
memoize def foo 
  'foo' 
end 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions