Project

General

Profile

Actions

Bug #11068

closed

unable to ommit an optional keyarg if the previous arg is an optional hash

Added by bughit (bug hit) over 9 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
[ruby-core:<unknown>]

Description

irb(main):001:0> def foo(hash = {}, a: nil); [hash, a] end
=> :foo
irb(main):002:0> foo({b: 1}, a: 1)
=> [{:b=>1}, 1]
irb(main):003:0> foo({b: 1})
ArgumentError: unknown keyword: b
	from (irb):1:in `foo'
	from (irb):3
	from /home/alex/.rbenv/versions/2.2.2/bin/irb:11:in `<main>'
irb(main):004:0> 

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #14183: "Real" keyword argumentClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0