summaryrefslogtreecommitdiff
path: root/lib/ostruct.rb
AgeCommit message (Collapse)Author
2020-11-04[ruby/ostruct] Update versionMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3736
2020-11-04[ruby/ostruct] Restore `ostruct` docMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3736
2020-11-04Revert "Make `marshal_load` public"Marc-Andre Lafortune
This reverts commit ee7cc6ac35cfb056b3946b1dcd6d4d5a140ccacf. I'm not sure I agree with the spec, but I just tweaked it. Notes: Merged: https://github.com/ruby/ruby/pull/3736
2020-10-27Separate `send` into `public_send` and `__send__`Nobuyoshi Nakada
2020-10-06Make `marshal_load` publicAaron Patterson
Ruby specs expected this method to be public
2020-10-06[lib/ostruct] Fix Marshal loadingMarc-Andre Lafortune
2020-09-30[ruby/ostruct] Tweak docMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3593
2020-09-30[ruby/ostruct] Remove unused conditionMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3593
2020-09-30[ruby/ostruct] Improved YAML serialization.Marc-Andre Lafortune
Patch adapted from Pietro Monteiro [Fixes bug#8382] Notes: Merged: https://github.com/ruby/ruby/pull/3593
2020-09-30[ruby/ostruct] Add test that frozen OpenStructs are Ractor-shareableMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3593
2020-09-30[ruby/ostruct] Protect subclass' methods and our bang methods.Marc-Andre Lafortune
Internally, use only bang methods Notes: Merged: https://github.com/ruby/ruby/pull/3593
2020-09-30[ruby/ostruct] Avoid calling initializeMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3593
2020-09-14[ruby/ostruct] Fix dup/cloneMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3541
2020-09-14[ruby/ostruct] method_missing is privateMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3541
2020-09-14[ruby/ostruct] Avoid self calling our public methods.Marc-Andre Lafortune
Found because `json` has a bad example in its test suite. This implementation still offers better encapsulation. Notes: Merged: https://github.com/ruby/ruby/pull/3541
2020-09-14[ruby/ostruct] Reinstate recent changesMarc-Andre Lafortune
This reverts commit 28e60b0045b5732bca11012d81a5223001faa6b2. Notes: Merged: https://github.com/ruby/ruby/pull/3541
2020-09-14[ruby/ostruct] Revert recent changesMarc-Andre Lafortune
This reverts commit e026e186f4..12a2e32d43.
2020-09-14[ruby/ostruct] Add access to public instance methods in case they are overridenMarc-Andre Lafortune
2020-09-14[ruby/ostruct] Tweak docMarc-Andre Lafortune
2020-09-14[ruby/ostruct] Allow overriding public methodsMarc-Andre Lafortune
[Fixes https://bugs.ruby-lang.org/issues/15409]
2020-09-14[ruby/ostruct] Refactor handling of frozen OpenStruct. Simplify ↵Marc-Andre Lafortune
`new_ostruct_member!`
2020-09-14[ruby/ostruct] Revert "ostruct.rb: deferred accessors"Marc-Andre Lafortune
This reverts commits: dc38e99813 22c082fcfd b499e0f9ff 58e5876646 Add test for overriden private methods [Fixes https://bugs.ruby-lang.org/issues/12136]
2020-09-04lib/ostruct.rb: Revert "To use RuntimeError instead of FrozenError for old ↵Marc-Andre Lafortune
ruby versions." This reverts commit 4cd1fc8b3559353069860eee90b1b5bade013917.
2020-08-14Fix links to Dig Methods document (#3421)Burdette Lamar
* Fix links to Dig Methods document * Fix links to Dig Methods document Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-08-13Adding doc/dig_methods.rdoc and links to it (#3416)Burdette Lamar
Adds a full discussion of #dig, along with links from Array, Hash, Struct, and OpenStruct. CSV::Table and CSV::Row are over in ruby/csv. I'll get to them soon. The art to the thing is to figure out how much (or how little) to say at each #dig. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-07-30Extract version number from the sourceNobuyoshi Nakada
"requiring version.rb" strategy has some issues. - cannot work when cross-compiling - often introduces wrong namespace - must know the superclasses - costs at each runtime than at build-time etc. Notes: Merged: https://github.com/ruby/ruby/pull/3375
2020-01-05Fix OpenStructDocumentationzverok
In https://github.com/ruby/ruby/commit/9be3295d53b6fd9f8a3ad8157aa0655b1976d8ac, OpenStruct's documentation stopped to be rendered by RDoc (there should be no additional code between documentation comment and documented class). Fixing this. Notes: Merged: https://github.com/ruby/ruby/pull/2810
2019-12-22[ruby/ostruct] Create OpenStruct::VERSIONMarc-Andre Lafortune
2019-05-10Removed old names of internal methodsNobuyoshi Nakada
2019-05-10Suppress a warning in Psych&YAML with verbose modeNobuyoshi Nakada
2019-04-14OpenStruct: improve error message when passing wrong number of arguments.marcandre
Patch by Lisa Ugray (issue #15515) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-22ostruct.rb: Accept block for to_h [#15451].marcandre
Patch by Shuji Kobayashi. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-07Support old versions of Ruby with FrozenError.hsbt
They should work separatedly from Ruby core repository. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-26lib/ostruct: Remove unnecessary `__send__`marcandre
Patch by yuuji.yaginuma [Fix GH-1890] Since `remove_method` is public. Ref: https://bugs.ruby-lang.org/issues/14133 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06lib/ostruct.rb: Use `FrozenError` instead of `RuntimeError`.marcandre
Patch by Yuuji Yaginuma. [Fixes GH-1808] In other classes, `FrozenError` will be raised if change the frozen object. In order to match the behavior, I think that `FrozenError` should use in `OpenStruct`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add uplevel keyword to Kernel#warn and use itshyouhei
If uplevel keyword is given, the warning message is prepended with caller file and line information and the string "warning: ". The use of the uplevel keyword makes Kernel#warn format output similar to how rb_warn formats output. This patch modifies net/ftp and net/imap to use Kernel#warn instead of $stderr.puts or $stderr.printf, since they are used for printing warnings. This makes lib/cgi/core and tempfile use $stderr.puts instead of warn for debug logging, since they are used for debug printing and not for warning. This does not modify bundler, rubygems, or rdoc, as those are maintained outside of ruby and probably wish to remain backwards compatible with older ruby versions. rb_warn_m code is originally from nobu, but I've changed it so that it only includes the path and lineno from uplevel (not the method), and also prepends the string "warning: ", to make it more similar to rb_warn. From: Jeremy Evans code@jeremyevans.net Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-24lib/ostruct.rb: Use frozen literals.marcandre
Patch adapted from Espartaco Palma. [GH-1714] [Bug #14000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-01ostruct.rb: improve fix for OpenStruct.allocate + #respond_to?eregon
* lib/ostruct.rb (OpenStruct#respond_to_missing?): this makes OpenStruct#respond_to? works on any OpenStruct instance, just like Kernel#respond_to? does, without workarounds. [ruby-core:80292] [Bug #13358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-28ostruct.rb: refine visibility failure messagenobu
* lib/ostruct.rb (method_missing): raise an exception with proper visibility message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-24ostruct.rb: fix OpenStruct.allocatenobu
* lib/ostruct.rb (OpenStruct.allocate): initialize an instance variable directly, without calling `intialize` method which may be overridden in a subclass. [ruby-core:80292] [Bug #13358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-11lib/ostruct.rb: [DOC] revise docs for OpenStructstomar
* update paragraph on implementation: define_singleton_method is used, not define_method * add call-seq with return values for each_pair * adopt description of dig from Array and Hash * fix description of the hash method * :nodoc: initialize_copy, respond_to_missing? * other small improvements, e.g. use the term `attribute' in the docs (instead of `member'), which is clearer for users of the class * improve code examples: e.g. use more consistent style (always use double quotes, drop `p' and `puts', ...), update inspect output, use example data that is not prone to change (like population) * add more code examples * fix some small errors and grammar [ruby-core:79265] [Bug #13159] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-03lib/ostruct.rb: Fix returned value of each_pair.marcandre
From a patch by Marcus Stollsteimer. [Fixes #13169] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-09* lib/ostruct.rb: [DOC] fix position of nodoc directive.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-03ostruct.rb: make internal methods privatenobu
* lib/ostruct.rb (modifiable?, new_ostruct_member!, table!): rename methods for internal use with suffixes and make private, [ruby-core:71069] [Bug #11587] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-01* lib/ostruct.rb: Fix case of frozen object with initializer.marcandre
Bug revealed by RubySpec [ruby-core:72639] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-31ostruct.rb: deferred accessorsnobu
* lib/ostruct.rb (freeze): define deferred accessors before freezing to get rid of an error when just reading frozen OpenStruct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-31* lib/ostruct.rb: Fix new_ostruct_member to correctly avoid redefinitionmarcandre
[#11901] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29ostruct.rb: respond_to?nobu
* lib/ostruct.rb (OpenStruct): make respond_to? working on just-allocated objects for workaround of Psych. [ruby-core:72501] [Bug #11884] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-12* lib/ostruct.rb: Have OpenStruct#dig raise if argument is not a symbolmarcandre
nor a string. See [#11762] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e