Project

General

Profile

Actions

Bug #12136

closed

OpenStruct.new(format: :bar).send :format # => too few arguments

Added by niko (Niko Dittmann) about 8 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
[ruby-core:74094]
Tags:

Description

#send(:format) to an OpenStruct with a field named :format raises an ArgumentError in Ruby 2.3.0:

OpenStruct.new(format: :bar).send :format
ArgumentError: too few arguments

It works as expected in ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux] and with any other method name I tried:

OpenStruct.new(f: :bar).send :f
=> :bar

String or Symbol in the OpenStruct definition and as argument of #send make no difference.


Related issues 3 (0 open3 closed)

Related to Ruby master - Bug #12251: DelegateClass(OpenStruct) behavior in 2.3.0 different from 2.2ClosedActions
Related to Ruby master - Bug #15409: OpenStruct error when attribute is called 'method'Closedmarcandre (Marc-Andre Lafortune)Actions
Related to Ruby master - Bug #18032: Openstruct is ~20..25x slower with Ruby 3.0.0 and 3.0.1 compared to earlier versionsRejectedmarcandre (Marc-Andre Lafortune)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0