How to deal a module included by a specified class like ActiveRecord::Base?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 256
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 37
Description
I write a concern module that supposes to be included by ActiveRecord::Base's subclass.
like following,
module A
extend ActiveSupport::Concern
included do
has_many :hoge
end
def bar
save
end
end
In such a case, module A supposes to have ActiveRecord::Base methods.
But, in the current RBS, developers must write all ActiveRecord::Base method signatures by themselves.
Because module cannot inherit class and class cannot be included (extended).
I want a helper syntax to include method signatures of other classes whether are not modules or interfaces.
For example:
module A
included_by ActiveRecord::Base # define method signatures with ActiveRecord::Base type
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed RBS syntax for module A and the ActiveRecord::Base example in the issue. Determine how signatures from a specified class should be exposed to an included module, including the interaction with ActiveSupport::Concern. Done means the behavior and syntax are defined well enough to support this use case without requiring developers to duplicate ActiveRecord::Base signatures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100