Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for class methods #3

Closed
hdf1996 opened this issue Mar 27, 2024 · 1 comment
Closed

Support for class methods #3

hdf1996 opened this issue Mar 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@hdf1996
Copy link
Contributor

hdf1996 commented Mar 27, 2024

Hi! First of all I loved the idea so far, thanks for making it open source! I also thought of something like this but I never actually implemented it. Sorbet is a little bit heavy lift and RBS is too far from runtime to me, but this is a simple implementation. I even think it may be eventually be able to export to RBS for IDE support (an entirely different conversation, but wanted to mention it)

While trying it out i found out it does not have support for class methods. Here's an example on how to reproduce

require 'delivered'

class User
  extend Delivered::Signature

  sig String, age: Integer, returns: String
  def initialize(name, age:)
      "User #{name} created with age #{age}"
  end

  sig String, returns: String
  def self.example(user)
      123
  end
end

User.example(1)
# should throw error because of the integer as parameter, and also because of the integer as returned value

I may be able to submit a PR for this in the short term, but wanted to submit the issue first, in case you or someone else wants to do it before

@joelmoss
Copy link
Owner

More than happy for you to submit a PR, thx. I would expect that I would need this in not too distant future

@joelmoss joelmoss added the enhancement New feature or request label Mar 27, 2024
@joelmoss joelmoss closed this as completed Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants