summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge branch 'zenspider/ruby-2.7' of https://github.com/zenspider/json into ↵Hiroshi SHIBATA2019-11-292-2/+11
|\ \ \ | | | | | | | | | | | | zenspider-zenspider/ruby-2.7
| * | | Fix warning from trying to access an uninitialized ivar.Ryan Davis2019-11-271-1/+2
| | | | | | | | | | | | | | | | Signed-off-by: Ryan Davis <zenspider@chef.io>
| * | | Minor cleanup for ruby 2.7 warnings and failures.Ryan Davis2019-11-272-3/+12
| |/ /
* | | Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans2019-10-311-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cfuncs that use rb_scan_args with the : entry suffer similar keyword argument separation issues that Ruby methods suffer if the cfuncs accept optional or variable arguments. This makes the following changes to : handling. * Treats as **kw, prompting keyword argument separation warnings if called with a positional hash. * Do not look for an option hash if empty keywords are provided. For backwards compatibility, treat an empty keyword splat as a empty mandatory positional hash argument, but emit a a warning, as this behavior will be removed in Ruby 3. The argument number check needs to be moved lower so it can correctly handle an empty positional argument being added. * If the last argument is nil and it is necessary to treat it as an option hash in order to make sure all arguments are processed, continue to treat the last argument as the option hash. Emit a warning in this case, as this behavior will be removed in Ruby 3. * If splitting the keyword hash into two hashes, issue a warning, as we will not be splitting hashes in Ruby 3. * If the keyword argument is required to fill a mandatory positional argument, continue to do so, but emit a warning as this behavior will be going away in Ruby 3. * If keyword arguments are provided and the last argument is not a hash, that indicates something wrong. This can happen if a cfunc is calling rb_scan_args multiple times, and providing arguments that were not passed to it from Ruby. Callers need to switch to the new rb_scan_args_kw function, which allows passing of whether keywords were provided. This commit fixes all warnings caused by the changes above. It switches some function calls to *_kw versions with appropriate kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS is used. If creating new arguments, RB_PASS_KEYWORDS is used if the last argument is a hash to be treated as keywords. In open_key_args in io.c, use rb_scan_args_kw. In this case, the arguments provided come from another C function, not Ruby. The last argument may or may not be a hash, so we can't set keyword argument mode. However, if it is a hash, we don't want to warn when treating it as keywords. In Ruby files, make sure to appropriately use keyword splats or literal keywords when calling Cfuncs that now issue keyword argument separation warnings through rb_scan_args. Also, make sure not to pass nil in place of an option hash. Work around Kernel#warn warnings due to problems in the Rubygems override of the method. There is an open pull request to fix these issues in Rubygems, but part of the Rubygems tests for their override fail on ruby-head due to rb_scan_args not recognizing empty keyword splats, which this commit fixes. Implementation wise, adding rb_scan_args_kw is kind of a pain, because rb_scan_args takes a variable number of arguments. In order to not duplicate all the code, the function internals need to be split into two functions taking a va_list, and to avoid passing in a ton of arguments, a single struct argument is used to handle the variables previously local to the function.
* | Pass args all #to_json in json/add/*.Sho Hashimoto2019-04-294-8/+8
| |
* | Bump version to 2.2.0Florian Frank2019-02-211-1/+1
| |
* | Fix a typo.Sho Hashimoto2019-02-211-1/+1
| |
* | JSON marshalling support for Set and SortedSetJosh Kline2017-10-041-0/+29
| |
* | Merge decimal_class patch by Michael JaschobFlorian Frank2016-09-232-2/+6
| | | | | | | | | | | | Also: - Avoid some issues with bundler - Avoid some issues with jruby
* | Correct documentation of OpenStruct.json_createKouhei Yanagita2016-08-301-1/+1
| |
* | Fix issue #296 when parsing frozen stringsFlorian Frank2016-07-261-1/+1
| |
* | Bump version to 2.0.1v2.0.1Florian Frank2016-07-011-1/+1
| |
* | Fix problem when Parser is defined on top levelFlorian Frank2016-07-011-1/+1
| | | | | | | | See flori/json#287
* | And stay thereFlorian Frank2016-06-221-0/+1
| |
* | Fix some merge problemsFlorian Frank2016-06-211-1/+0
| |
* | Support 1.9 ruby's OpenStructFlorian Frank2016-06-211-0/+8
| |
* | Add frozen_string_literal: falseNobuyoshi Nakada2016-06-2119-0/+19
| | | | | | | | When you change this to true, you may need to add more tests.
* | Remove useless methodsNobuyoshi Nakada2016-06-211-8/+0
| | | | | | | | | | Remove useless overriding methods, [] and []=, which are same as OpenStruct.
* | Append newline at EOFNobuyoshi Nakada2016-06-211-1/+1
| |
* | Merge pull request #283 from stomar/remove-commentsFlorian Frank2016-06-079-9/+0
|\ \ | | | | | | Remove comments from core classes in json/add
| * | Remove comments from core classes in json/addMarcus Stollsteimer2016-04-259-9/+0
| | |
* | | Move simplecov to test_helper.rbFlorian Frank2016-06-032-14/+2
| | |
* | | Treat ASCII_8BIT as UTF-8 by defaultFlorian Frank2016-06-031-2/+4
| | |
* | | Only support newer Rubies e. g. EncodingFlorian Frank2016-06-031-101/+47
| | |
* | | Test common interfaceFlorian Frank2016-06-031-14/+4
| | |
* | | Use better name for this featureFlorian Frank2016-06-021-4/+4
| | |
* | | Remove quirks modeFlorian Frank2016-06-023-31/+7
| | |
* | | Change rfc referenceFlorian Frank2016-06-022-24/+6
|/ /
* | Merge branch 'v1.8'Florian Frank2016-02-251-2/+10
|\ \
| * | Check for existence of #to_json method before callFlorian Frank2016-02-251-2/+10
| | |
| * | Skip 1.8.4Florian Frank2015-10-201-1/+1
| | |
| * | Bump version to 1.8.4 and add to CHANGESFlorian Frank2015-09-111-1/+1
| | |
* | | Disallow usage of symbolize_names and create_additionsFlorian Frank2015-06-151-2/+6
| | |
* | | Refactor tests and make pure parser greenFlorian Frank2015-06-153-45/+28
| | |
* | | Remove generate restriction for […]/{…}Florian Frank2015-06-131-7/+0
| | |
* | | Remove byte sniffing from Pure::ParserFlorian Frank2015-06-131-33/+1
| | |
* | | Move common setup into test_helper.rbFlorian Frank2015-06-131-2/+3
|/ /
* | Bump version to 1.8.3v1.8.3Florian Frank2015-06-011-1/+1
| |
* | Bump version number to 1.8.2Florian Frank2015-01-091-1/+1
| |
* | Merge branch 'master' into zzak-ruby-2.2Florian Frank2015-01-024-6/+17
|\ \
| * | Don't mutate JSON.dump_default_options from dumpJason R. Clark2015-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | The use of Hash#update from the JSON.dump method was mutating the dump_default_options hash on any call to dump with a limit provided. An individual method call with an overriding value shouldn't update the defaults in this way.
| * | ReindentedFlorian Frank2015-01-021-7/+6
| | |
| * | Document `Rational` json generation methods.Vipul A M2015-01-021-4/+10
| | |
| * | Document `Complex` json generation methods.Vipul A M2015-01-021-1/+7
| | |
| * | Use method_defined? to check if method exists instead of slower check on ↵Vipul A M2015-01-021-1/+1
| | | | | | | | | | | | instance_methods
| * | Change documentation to reflect new default valueFlorian Frank2015-01-021-2/+2
| | |
| * | Fix typo in commentIgnacio Galindo2015-01-021-1/+1
| | |
* | | Sync with trunkZachary Scott2014-12-254-18/+7
| | |
* | | Don't mutate JSON.dump_default_options from dumpJason R. Clark2014-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | The use of Hash#update from the JSON.dump method was mutating the dump_default_options hash on any call to dump with a limit provided. An individual method call with an overriding value shouldn't update the defaults in this way.
* | | ReindentedFlorian Frank2014-07-031-7/+6
| | |