Project

General

Profile

Bug #15409

OpenStruct error when attribute is called 'method'

Added by elioncho (Elías Orozco) almost 2 years ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
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

Related to Ruby master - Bug #12136: OpenStruct.new(format: :bar).send :format # => too few argumentsClosedActions

Also available in: Atom PDF