Project

General

Profile

Actions

Bug #15409

closed

OpenStruct error when attribute is called 'method'

Added by elioncho (Elías Orozco) over 5 years ago. Updated over 3 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]
[ruby-core:90481]
Tags:

Description

The following error is shown when you try to access an OpenStruct with a property called method:

`method': wrong number of arguments (given 0, expected 1) (ArgumentError)

To replicate:

require 'ostruct'
o = OpenStruct.new({ method: 'get' })
o.method

The expected behavior should be to return 'get'


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #12136: OpenStruct.new(format: :bar).send :format # => too few argumentsClosedActions
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
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0