Skip to content

Instantly share code, notes, and snippets.

@gkellogg
Created April 29, 2016 19:45
Show Gist options
  • Save gkellogg/5eb45b551d2662c6e78af9d20c5ad99a to your computer and use it in GitHub Desktop.
Save gkellogg/5eb45b551d2662c6e78af9d20c5ad99a to your computer and use it in GitHub Desktop.
Rubinius splat with **options bug
class Outer
def initialize(*args, **options)
raise ArgumentError, "args should be an array of a String, was #{args.inspect}" if args.first.is_a?(Array)
end
end
class Inner < Outer
def initialize(*args, **options)
super
end
end
Inner.new("foo", bar: :baz)
$ rbx rbx-bug.rb
An exception occurred running rbx-bug.rb
args should be an array of a String, was [["foo"], "foo"] (ArgumentError)
Backtrace:
Outer(Inner)#initialize at rbx-bug.rb:3
Inner#initialize at rbx-bug.rb:9
Object#__script__ at rbx-bug.rb:13
Rubinius::CodeLoader#load_script at kernel/delta/code_loader.rb:66
Rubinius::CodeLoader.load_script at kernel/delta/code_loader.rb:152
Rubinius::Loader#script at kernel/loader.rb:656
Rubinius::Loader#main at kernel/loader.rb:842
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment