From 38be7638f2933b123d4e67ac8f40da06617e346b Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 11 Aug 2021 10:55:45 +0900 Subject: [PATCH] Fix typos (#690) --- CHANGELOG.md | 26 +++++++++++++------------- README.md | 2 +- Rakefile | 2 +- ext/oj/custom.c | 2 +- ext/oj/fast.c | 2 +- ext/oj/object.c | 2 +- ext/oj/oj.c | 6 +++--- ext/oj/parse.c | 2 +- ext/oj/rxclass.c | 2 +- ext/oj/saj.c | 2 +- ext/oj/sparse.c | 2 +- ext/oj/stream_writer.c | 2 +- ext/oj/string_writer.c | 4 ++-- lib/oj/error.rb | 2 +- notes | 2 +- pages/Options.md | 2 +- pages/Parser.md | 6 +++--- pages/Rails.md | 4 ++-- samples/wrapexception.rb | 2 +- test/json_gem/json_generator_test.rb | 2 +- test/test_hash.rb | 2 +- 21 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3ea6026..61ed850a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -175,13 +175,13 @@ Remove license from code. - Fixed issue #569. `:compat` mode not restricts the escape mode as indicated in the documentation. -- Fixed issue #570. In `:strict` mode number parsing follows the JSON specification more closely as indended. +- Fixed issue #570. In `:strict` mode number parsing follows the JSON specification more closely as intended. - Added `:ignore_under` which when true will ignore attributes that begin with a `_` when dumping in `:object` or `:custom` mode. ## 3.9.2 - 2019-10-01 -- Fixed wrong exception type when mimicing the JSON gem. +- Fixed wrong exception type when mimicking the JSON gem. ## 3.9.1 - 2019-08-31 @@ -225,7 +225,7 @@ Remove license from code. - Return correct value in `create_opt` C function. -- Return `Oj::ParseError` if an invalid big decimal string is encounted instead of an argument error +- Return `Oj::ParseError` if an invalid big decimal string is encountered instead of an argument error ## 3.7.8 - 2019-01-21 @@ -251,11 +251,11 @@ Remove license from code. ## 3.7.5 - 2018-12-27 - - Address issue #517 with a special escape table for mimicing the JSON gem. + - Address issue #517 with a special escape table for mimicking the JSON gem. ## 3.7.4 - 2018-11-29 - - Allow `+` in front of numbers in parse as well as stream parse **EXCEPT** when mimicing the JSON gem. + - Allow `+` in front of numbers in parse as well as stream parse **EXCEPT** when mimicking the JSON gem. ## 3.7.3 - 2018-11-29 @@ -293,7 +293,7 @@ Remove license from code. ## 3.6.10 - 2018-09-13 - - Additional occurances of `SYM2ID(sym)` replaced. + - Additional occurrences of `SYM2ID(sym)` replaced. ## 3.6.9 - 2018-09-12 @@ -301,7 +301,7 @@ Remove license from code. ## 3.6.8 - 2018-09-08 - - Stopped setting the default options when optimze rails is called as the documentaiton has indicated. + - Stopped setting the default options when optimize rails is called as the documentation has indicated. - In custom mode `Date` and `DateTime` instances default to use the `:time_format` option is the `:create_additions` option is false. @@ -479,7 +479,7 @@ Remove license from code. - Float significant digits now match Ruby's unless optimized and then significant digits are set to 16. -- Rails Hash post merging of identical keys after calling as_json is preserved only for un-optimized Hashs. +- Rails Hash post merging of identical keys after calling as_json is preserved only for un-optimized Hashes. - Raise an exception to match json gem behavior on invalid unicode. @@ -526,7 +526,7 @@ Remove license from code. ## 3.0.0 - 2017-04-24 -- Major changes focussed on json gem and Rails compatibility. A new :custom +- Major changes focused on json gem and Rails compatibility. A new :custom mode was added as well. Starting with this release the json gem tests are being used to test the :compat mode and the ActiveSupport 5 tests are being used to test the :rails mode. @@ -705,8 +705,8 @@ Remove license from code. ## 2.12.0 - 2015-03-06 -- String formats for UTC time are now explitly UTC instead of offset of zero. This fixes a problem with pre-2.2.0 Rubies that automatically convert zero offset times to local times. -- Added :unix_zone time_format option for formating numeric time. This option is the same as the :unix time option but the UTC offset is included as an exponent to the number time value. A value of 86400 is an indication of UTC time. +- String formats for UTC time are now explicitly UTC instead of offset of zero. This fixes a problem with pre-2.2.0 Rubies that automatically convert zero offset times to local times. +- Added :unix_zone time_format option for formatting numeric time. This option is the same as the :unix time option but the UTC offset is included as an exponent to the number time value. A value of 86400 is an indication of UTC time. ## 2.11.5 - 2015-02-25 @@ -819,7 +819,7 @@ Remove license from code. ## 2.9.0 - 2014-05-01 -- Added support for detection and handling of Strng, Array, and Hash subclasses. +- Added support for detection and handling of String, Array, and Hash subclasses. - Oj.load() can now take a block which will be yielded to on every object parsed when used with a file or string with multiple JSON entries. ## 2.8.1 - 2014-04-21 @@ -1057,7 +1057,7 @@ Remove license from code. ## 1.4.4 - 2012-11-07 -- Fixed bug in mimic that missed mimicing json_pure. +- Fixed bug in mimic that missed mimicking json_pure. ## 1.4.3 - 2012-10-19 diff --git a/README.md b/README.md index 7c7c52c8..a739a26d 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ For more details on options, modes, advanced features, and more follow these links. - [{file:Options.md}](pages/Options.md) for parse and dump options. - - [{file:Modes.md}](pages/Modes.md) for details on modes for strict JSON compliance, mimicing the JSON gem, and mimicing Rails and ActiveSupport behavior. + - [{file:Modes.md}](pages/Modes.md) for details on modes for strict JSON compliance, mimicking the JSON gem, and mimicking Rails and ActiveSupport behavior. - [{file:JsonGem.md}](pages/JsonGem.md) includes more details on json gem compatibility and use. - [{file:Rails.md}](pages/Rails.md) includes more details on Rails and ActiveSupport compatibility and use. - [{file:Custom.md}](pages/Custom.md) includes more details on Custom mode. diff --git a/Rakefile b/Rakefile index 25b5d58f..d9710d62 100644 --- a/Rakefile +++ b/Rakefile @@ -28,7 +28,7 @@ task :test_all => [:clean, :compile] do end exitcode = 1 unless status - # Verifying that json gem tests work for native implemntation for Ruby 2.4.0 + # Verifying that json gem tests work for native implementation for Ruby 2.4.0 # and above only. We know the older versions do not pass the 2.4.0 unit # tests. if RUBY_VERSION >= '2.4' diff --git a/ext/oj/custom.c b/ext/oj/custom.c index c5adb46a..aaa47e04 100644 --- a/ext/oj/custom.c +++ b/ext/oj/custom.c @@ -1032,7 +1032,7 @@ static void hash_set_num(struct _parseInfo *pi, Val kval, NumInfo ni) { } if (86400 == ni->exp) { // UTC time parent->val = rb_time_nano_new(ni->i, (long)nsec); - // Since the ruby C routines alway create local time, the + // Since the ruby C routines always create local time, the // offset and then a conversion to UTC keeps makes the time // match the expected value. parent->val = rb_funcall2(parent->val, oj_utc_id, 0, 0); diff --git a/ext/oj/fast.c b/ext/oj/fast.c index ca7a8c74..bd813f21 100644 --- a/ext/oj/fast.c +++ b/ext/oj/fast.c @@ -1472,7 +1472,7 @@ static VALUE doc_move(VALUE self, VALUE str) { * to the block on yield is the Doc instance after moving to the child * location. * @param [String] path if provided it identified the top of the branch to - * process the chilren of + * process the children of * @yieldparam [Doc] Doc at the child location * @example * Oj::Doc.open('[3,[2,1]]') { |doc| diff --git a/ext/oj/object.c b/ext/oj/object.c index 0bdc394f..8e6f182c 100644 --- a/ext/oj/object.c +++ b/ext/oj/object.c @@ -301,7 +301,7 @@ static int hat_num(ParseInfo pi, Val parent, Val kval, NumInfo ni) { } if (86400 == ni->exp) { // UTC time parent->val = rb_time_nano_new(ni->i, (long)nsec); - // Since the ruby C routines alway create local time, the + // Since the ruby C routines always create local time, the // offset and then a conversion to UTC keeps makes the time // match the expected value. parent->val = rb_funcall2(parent->val, oj_utc_id, 0, 0); diff --git a/ext/oj/oj.c b/ext/oj/oj.c index 3193f575..f01f656f 100644 --- a/ext/oj/oj.c +++ b/ext/oj/oj.c @@ -509,7 +509,7 @@ static VALUE get_def_opts(VALUE self) { * Sets the default options for load and dump. * - *opts* [_Hash_] options to change * - *:indent* [_Fixnum_|_String_|_nil_] number of spaces to indent each element in a JSON - *document or the String to use for identation. + *document or the String to use for indentation. * - :circular [_Boolean_|_nil_] support circular references while dumping. * - *:auto_define* [_Boolean_|_nil_] automatically define classes if they do not exist. * - *:symbol_keys* [_Boolean_|_nil_] convert hash keys to symbols. @@ -1398,7 +1398,7 @@ static VALUE to_json(int argc, VALUE *argv, VALUE self) { * Dumps an Object to the specified file. * - *file* [_String_] _path file path to write the JSON document to * - *obj* [_Object_] Object to serialize as an JSON document String - * - *options* [_Hash_] formating options + * - *options* [_Hash_] formatting options * - *:indent* [_Fixnum_] format expected * - *:circular* [_Boolean_] allow circular references, default: false */ @@ -1420,7 +1420,7 @@ static VALUE to_file(int argc, VALUE *argv, VALUE self) { * Dumps an Object to the specified IO stream. * - *io* [_IO_] IO stream to write the JSON document to * - *obj* [_Object_] Object to serialize as an JSON document String - * - *options* [_Hash_] formating options + * - *options* [_Hash_] formatting options * - *:indent* [_Fixnum_] format expected * - *:circular* [_Boolean_] allow circular references, default: false */ diff --git a/ext/oj/parse.c b/ext/oj/parse.c index 992b5253..b9710c13 100644 --- a/ext/oj/parse.c +++ b/ext/oj/parse.c @@ -489,7 +489,7 @@ static void read_num(ParseInfo pi) { if ('.' == *pi->cur) { pi->cur++; // A trailing . is not a valid decimal but if encountered allow it - // except when mimicing the JSON gem or in strict mode. + // except when mimicking the JSON gem or in strict mode. if (StrictMode == pi->options.mode || CompatMode == pi->options.mode) { int pos = (int)(pi->cur - ni.str); diff --git a/ext/oj/rxclass.c b/ext/oj/rxclass.c index 237d4d08..b679f591 100644 --- a/ext/oj/rxclass.c +++ b/ext/oj/rxclass.c @@ -110,7 +110,7 @@ oj_rxclass_match(RxClass rc, const char *str, int len) { } } else if (len < (int)sizeof(buf)) { #if !IS_WINDOWS - // string is not \0 terminated so copy and atempt a match + // string is not \0 terminated so copy and attempt a match memcpy(buf, str, len); buf[len] = '\0'; if (0 == regexec(&rxc->rx, buf, 0, NULL, 0)) { // match diff --git a/ext/oj/saj.c b/ext/oj/saj.c index 1a7d8dbe..cffaf378 100644 --- a/ext/oj/saj.c +++ b/ext/oj/saj.c @@ -628,7 +628,7 @@ static void saj_parse(VALUE handler, char *json) { * @param [IO|String] io IO Object to read from * @deprecated The sc_parse() method along with the ScHandler is the preferred * callback parser. It is slightly faster and handles streams while the - * saj_parse() methos requires a complete read before parsing. + * saj_parse() method requires a complete read before parsing. * @see sc_parse */ VALUE diff --git a/ext/oj/sparse.c b/ext/oj/sparse.c index a3822afd..64213067 100644 --- a/ext/oj/sparse.c +++ b/ext/oj/sparse.c @@ -494,7 +494,7 @@ static void read_num(ParseInfo pi) { if ('.' == c) { c = reader_get(&pi->rd); // A trailing . is not a valid decimal but if encountered allow it - // except when mimicing the JSON gem. + // except when mimicking the JSON gem. if (CompatMode == pi->options.mode) { if (c < '0' || '9' < c) { oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "not a number"); diff --git a/ext/oj/stream_writer.c b/ext/oj/stream_writer.c index 70ce8063..5861d0b0 100644 --- a/ext/oj/stream_writer.c +++ b/ext/oj/stream_writer.c @@ -67,7 +67,7 @@ static VALUE buffer_size_sym = Qundef; * should be and also a hint on when to flush. * * - *io* [_IO_] stream to write to - * - *options* [_Hash_] formating options + * - *options* [_Hash_] formatting options */ static VALUE stream_writer_new(int argc, VALUE *argv, VALUE self) { StreamWriterType type = STREAM_IO; diff --git a/ext/oj/string_writer.c b/ext/oj/string_writer.c index e8c58195..af80b514 100644 --- a/ext/oj/string_writer.c +++ b/ext/oj/string_writer.c @@ -248,7 +248,7 @@ static void str_writer_free(void *ptr) { * should be. * * - *io* [_IO_] stream to write to - * - *options* [_Hash_] formating options + * - *options* [_Hash_] formatting options */ static VALUE str_writer_new(int argc, VALUE *argv, VALUE self) { StrWriter sw = ALLOC(struct _strWriter); @@ -466,7 +466,7 @@ static VALUE str_writer_as_json(VALUE self) { * by pushing values into the document. Pushing an array or an object will * create that element in the JSON document and subsequent pushes will add the * elements to that array or object until a pop() is called. When complete - * calling to_s() will return the JSON document. Note tha calling to_s() before + * calling to_s() will return the JSON document. Note that calling to_s() before * construction is complete will return the document in it's current state. */ void oj_string_writer_init() { diff --git a/lib/oj/error.rb b/lib/oj/error.rb index e200aa09..0847c94d 100644 --- a/lib/oj/error.rb +++ b/lib/oj/error.rb @@ -16,7 +16,7 @@ module Oj # An Exception that is raised if a file fails to load. LoadError = Class.new(Error) - # An Exception that is raised if there is a conflict with mimicing JSON + # An Exception that is raised if there is a conflict with mimicking JSON MimicError = Class.new(Error) end # Oj diff --git a/notes b/notes index 50ff2ee9..046d3d8f 100644 --- a/notes +++ b/notes @@ -77,7 +77,7 @@ Oj.optimize_rails Oj.default_options = { mode: :rails, bigdecimal_as_decimal: true } It does the job - Oj dumps BigDecimal as number. -If I later add bigdecimal_as_decimal: true explicitely in the dump it works for single number dump, but not for Hash. +If I later add bigdecimal_as_decimal: true explicitly in the dump it works for single number dump, but not for Hash. Oj.dump(BigDecimal('1.2')) # => "1.2" Oj.dump({a: BigDecimal('1.2')}) # => "{\"a\":1.2}" diff --git a/pages/Options.md b/pages/Options.md index c7b4923f..e2364498 100644 --- a/pages/Options.md +++ b/pages/Options.md @@ -268,7 +268,7 @@ Use symbols instead of strings for hash keys. ### :symbolize_names [Boolean] Like :symbol_keys has keys are made into symbols but only when -mimicing the JSON gem and then only as the JSON gem honors it so +mimicking the JSON gem and then only as the JSON gem honors it so JSON.parse honors the option but JSON.load does not. ### :trace diff --git a/pages/Parser.md b/pages/Parser.md index 6d94b0b1..0ed79d31 100644 --- a/pages/Parser.md +++ b/pages/Parser.md @@ -42,12 +42,12 @@ bleed over to other instances. ## How -It's wonderfull to wish for a faster parser that solves all the +It's wonderful to wish for a faster parser that solves all the annoyances of the previous parser but how was it done is a much more interesting question to answer. At the core, the API for parsing was changed. Instead of a sinle -global parser any number of parsers can be created and each is seprate +global parser any number of parsers can be created and each is separate from the others. The parser itself is able to rip through a JSON string, stream, or file and then make calls to a delegate to process the JSON elements according to the delegate behavior. This is similar @@ -206,7 +206,7 @@ in array creation. For Hash the story is a little different. The bulk insert for Hash alternates keys and values but there is a wrinkle to consider. Since -Ruby Object creation is triggered by the occurance of an element that +Ruby Object creation is triggered by the occurrence of an element that matches a creation identifier the creation of a collection is not just for Array and Hash but also Object. Setting Object attributes uses an ID and not a VALUE. For that reason the keys should not be created as diff --git a/pages/Rails.md b/pages/Rails.md index 5af580fb..e26ce736 100644 --- a/pages/Rails.md +++ b/pages/Rails.md @@ -41,7 +41,7 @@ The globals that ActiveSupport uses for encoding are: Those globals are aliased to also be accessed from the ActiveSupport module directly so `ActiveSupport::JSON::Encoding.time_precision` can also be accessed -from `ActiveSupport.time_precision`. Oj makes use of these globals in mimicing +from `ActiveSupport.time_precision`. Oj makes use of these globals in mimicking Rails after the `Oj::Rails.set_encode()` method is called. That also sets the `ActiveSupport.json_encoder` to the `Oj::Rails::Encoder` class. @@ -125,7 +125,7 @@ gem 'oj', '3.7.12' Ruby which is used by the json gem and by Rails. Ruby varies the significant digits which can be either 16 or 17 depending on the value. -2. Optimized Hashs do not collapse keys that become the same in the output. As +2. Optimized Hashes do not collapse keys that become the same in the output. As an example, a non-String object that has a `to_s()` method will become the return value of the `to_s()` method in the output without checking to see if that has already been used. This could occur is a mix of String and Symbols diff --git a/samples/wrapexception.rb b/samples/wrapexception.rb index 3d8e2c63..f0d4ea90 100644 --- a/samples/wrapexception.rb +++ b/samples/wrapexception.rb @@ -15,7 +15,7 @@ # Oj is not able to automatically deserialize all classes that are a subclass of # a Ruby Exception. Only exception that take one required string argument in the # initialize() method are supported. This is an example of how to write an -# Exception subclass that supports both a single string intializer and an +# Exception subclass that supports both a single string initializer and an # Exception as an argument. Additional optional arguments can be added as well. # # The reason for this restriction has to do with a design decision on the part diff --git a/test/json_gem/json_generator_test.rb b/test/json_gem/json_generator_test.rb index 0d150161..8234b501 100644 --- a/test/json_gem/json_generator_test.rb +++ b/test/json_gem/json_generator_test.rb @@ -113,7 +113,7 @@ def test_own_state end # TBD Implement JSON.state to return state class. - # set state attibutes from defaults + # set state attributes from defaults # implement methods # circular should use circular in defaults or maybe always set to true, allow changes with [:check_circular]= def test_states diff --git a/test/test_hash.rb b/test/test_hash.rb index cfad737f..e77f3527 100755 --- a/test/test_hash.rb +++ b/test/test_hash.rb @@ -5,7 +5,7 @@ require 'helper' -class Hashi < Minitest::Test +class HashTest < Minitest::Test module TestModule end