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

Call abs on arity when extracting reload #27

Conversation

bradylove
Copy link

Fixes #23

  • Optional arguments in the method signature cause arity to be a
    negative number. Call abs on the method arity to fix optional values not
    working and throwing something like:

    ArgumentError: wrong number of arguments (3 for 2)

@bradylove bradylove changed the title Call abs on arity when extracting reaload Call abs on arity when extracting reload Sep 11, 2014
@bradylove bradylove force-pushed the fix-optional-value-not-supported branch from 2b8e2e1 to 80c6163 Compare September 11, 2014 01:14
* Optional arguments in the method signature cause arity to be a
  negative number. Call abs on the method arity to fix option values not
  working and throwing something like:

  ArgumentError:   wrong number of arguments (3 for 2)
@bradylove bradylove force-pushed the fix-optional-value-not-supported branch from 80c6163 to 051c56c Compare September 11, 2014 01:18
matthewrudy added a commit that referenced this pull request Oct 10, 2014
…pported

Call abs on arity when extracting reload
@matthewrudy matthewrudy merged commit 85b9f72 into matthewrudy:master Oct 10, 2014
@gamov
Copy link

gamov commented Oct 10, 2014

👍

@dark-panda
Copy link

This appears to break some method prototypes. For instance...

class Foo
  extend Memoist

  def two_optional_args(i = 0, j = false)
    "#{i} #{j}"
  end
  memoize :two_optional_args
end

Foo.new.two_optional_args("one", false)
# "one false"

Foo.new.two_optional_args("one", true) 
# "one false", but "one true" expected

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.

Optional value not supported for last argument?
4 participants