mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/ostruct] Restore ostruct
doc
This commit is contained in:
parent
6f24be8565
commit
015b023820
Notes:
git
2020-11-05 07:52:32 +09:00
1 changed files with 3 additions and 3 deletions
|
@ -36,15 +36,15 @@
|
|||
# Hash keys with spaces or characters that could normally not be used for
|
||||
# method calls (e.g. <code>()[]*</code>) will not be immediately available
|
||||
# on the OpenStruct object as a method for retrieval or assignment, but can
|
||||
# still be reached through the Object#__send__ method or using [].
|
||||
# still be reached through the Object#send method or using [].
|
||||
#
|
||||
# measurements = OpenStruct.new("length (in inches)" => 24)
|
||||
# measurements[:"length (in inches)"] # => 24
|
||||
# measurements.__send__("length (in inches)") # => 24
|
||||
# measurements.send("length (in inches)") # => 24
|
||||
#
|
||||
# message = OpenStruct.new(:queued? => true)
|
||||
# message.queued? # => true
|
||||
# message.__send__("queued?=", false)
|
||||
# message.send("queued?=", false)
|
||||
# message.queued? # => false
|
||||
#
|
||||
# Removing the presence of an attribute requires the execution of the
|
||||
|
|
Loading…
Reference in a new issue