Skip to content

Conversation

@phillipspc
Copy link
Contributor

@phillipspc phillipspc commented Nov 11, 2024

Related to #134


The current implementation of #push was only allowing for one value to
be passed in, but if the goal is to match ruby's functionality, then it
should accept multiple.

We also want to ensure that we perform the right type checking logic for
both scenarios.

@phillipspc phillipspc marked this pull request as draft November 11, 2024 02:25
The current implementation of `#push` was only allowing for one value to
be passed in, but if the goal is to match ruby's functionality, then it
should accept multiple.

We also want to ensure that we perform the right type checking logic for
both scenarios.
While we're here, let's add the `#append` method alias.
@phillipspc phillipspc marked this pull request as ready for review November 11, 2024 02:34
def push(*value)
case value
when ::Array
Literal::Array(@__type__).new(*value)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seemed like the best way of forcing the type check to happen on an array of values. But 🤷‍♂️

@joeldrapper joeldrapper merged commit ce97bd6 into yippee-fun:main Nov 11, 2024
10 checks passed
@stevegeek
Copy link
Collaborator

Thanks @phillipspc !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants