From: sto.mar@... Date: 2013-06-21T04:14:13+09:00 Subject: Re: Why the `#new_ostruct_member` not being able to add the `:email` ? Am 20.06.2013 20:58, schrieb Love U Ruby: > unknown wrote in post #1113026: >> Am 20.06.2013 12:09, schrieb Love U Ruby: >>> require 'ostruct' >>> >>> contact = OpenStruct.new(first_name: "John", last_name: "Smith", phone: >>> "XXXXXXX") >>> >>> contact.send(:new_ostruct_member ,:email) #= "john.doe@mymail.com" >> >> simply use >> >> contact.email = 'john.doe@mymail.com' > > Actually I was trying to understand the intention of providing such > feature method `#new_ostruct_member`. It's not really a "provided" feature, `new_ostruct_member' is meant to be "Used internally" (quoted from the docs). That's the reason it is not declared as a public method. Generally, it is bad practice to rely on private/protected methods. The public interface of a library is usually well defined and stable, but internally used methods might change anytime without further notice. --