pocke / rbs_rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to skip a method from gems?

khrisnagunanasurya opened this issue · comments

Hi, I have a problem with how to mock/ignore the classes or methods from gems, I use a gem called AASM, where when we include the AASM into the model, we can use the helper method like aasm, transitions, ... etc.
But I'm unable to make RBS ignore those methods or try to mock them inside RBS. can someone help me with this?

What I've been trying so far

  class History < ::ApplicationRecord
    ...

    module AasmGem
      module ClassMethods
        def aasm: (*untyped) { () -> void } -> void

        def event: (Symbol) -> void

        def transitions: (from: Symbol, to: Symbol) -> void
      end
    end
    include AasmGem

    ...
  end

How about to use extend instead of include?

- include AasmGem
+ extend AasmGem::ClassMethods

Thanks, it's working