Code Monkey home page Code Monkey logo

delivered's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hdf1996

delivered's Issues

Incorrect exception when giving an unknown arg

Calling this...

confirm! off_session: true

on a method with this signature...

sig manual: T.Boolean, payment_method_id: T.Nilable(String)

Raises...

Delivered::ArgumentError: `Transaction::PaymentIntent#confirm!` expected `` as keyword arg :off_session, but received `true`

Globally disable type checking

Type checking may not always be needed, for example you may not want it in production. A ENV var could be a good way to disable type checking globally.

Replace and avoid possible conflict of `returns` kwarg

Currently sig uses a returns keyword arg, which can obviously conflict. We can change it to one of the following, but not sure which… 🤔

sig [String, age: Integer] => User

or…

sig(String, age: Integer) { User }

... or both!

Support for class methods

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

User friendly exceptions

Right now a NoMatchingPatternError exception is raised when a type does not match. This is great for us devs, but not so much for end users.

Boolean support

Hi! Curious if boolean types are supported in this implementation, and if so how it'll be done on the sig call. Specifically asking because
Boolean type doesn't exist as such.

sig Boolean, returns: Boolean
def something(b)
  !b
end

Some alternatives if that's not implemented, can be to create a class to be used as type like Sorbet or RBS does Types::Boolean or Bool

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.