summaryrefslogtreecommitdiff
path: root/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* Add changelog entryAnton Rieder2020-05-291-0/+1
|
* Added TOC and upgraded danger-changelog to verify the keep-a-changelog ↵dblock2020-05-081-56/+30
| | | | formatted CHANGELOG.
* Hashie mascot (#522)Caroline Artz2020-05-081-0/+1
|
* Changes to `Mash` initialization key string conversion. (#521)Caroline Artz2020-05-041-0/+2
|
* Correct link to PR in CHANGELOG.mdAnton Rieder2020-02-281-1/+1
|
* Remove text I missed during releaseBobby McDonald2020-02-011-1/+0
|
* Preparing for next development iteration, 4.1.1.Bobby McDonald2020-02-011-0/+32
|
* Preparing for release, 4.1.0v4.1.0Bobby McDonald2020-02-011-20/+2
|
* Suppress a Ruby's warning when using Ruby 2.6.0+Koichi ITO2020-01-181-0/+1
| | | | | | | | | | | | | | | | | | | This PR suppresses the following warning that `deep_merge` method and `deep_update` method are defined twice when using Ruby 2.6.0+. ```console % bundle exec rake (snip) /Users/koic/src/github.com/hahie/hashie/lib/hashie/mash.rb:226: warning: method redefined; discarding old deep_merge /Users/koic/src/github.com/hahie/hashie/lib/hashie/mash.rb:212: warning: previous definition of deep_merge was here /Users/koic/src/github.com/hahie/hashie/lib/hashie/mash.rb:232: warning: method redefined; discarding old deep_update /Users/koic/src/github.com/hahie/hashie/lib/hashie/mash.rb:218: warning: previous definition of deep_update was here ```
* Suppress an integer unification warning for Ruby 2.4.0+Koichi ITO2020-01-161-0/+1
| | | | | | | | | | | | | | | | | This PR suppresss the following integer unification warning for Ruby 2.4.0+ ```console % ruby -v ruby 2.4.9p362 (2019-10-02 revision 67824) [x86_64-darwin17] % bundle exec rspec spec/hashie/extensions/deep_merge_spec.rb Hashie::Extensions::DeepMerge /Users/koic/src/github.com/hahie/hashie/lib/hashie/utils.rb:38: warning: constant ::Fixnum is deprecated /Users/koic/src/github.com/hahie/hashie/lib/hashie/utils.rb:38: warning: constant ::Bignum is deprecated ```
* Merge pull request #511 from koic/suppress_kwargs_warning_for_ruby_2_7_0Daniel Doubrovkine (dB.) @dblockdotorg2020-01-151-0/+1
|\ | | | | Suppress keyword arguments warning for Ruby 2.7.0
| * Suppress keyword arguments warning for Ruby 2.7.0Koichi ITO2020-01-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR suppresses the following keyword arguments warning for Ruby 2.7.0. ```console % bundle exec rspec spec/hashie/extensions/mash/symbolize_keys_spec.rb (snip) /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:29: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:21: warning: The called method `call' is defined here ``` For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`. ruby/ruby#2794
* | Don't warn when setting most affixed keys (#500)Michael Herold2020-01-151-0/+1
|/ | | | | | | | | | | | | | | | | | | | | Due to how we have implemented the bang/underbang/query behavior within Mash, setting keys that have those affixes in them actually allow overwriting the behavior of those affixes. As such, we shouldn't warn when setting a key that matches those patterns. When it comes to setter-like keys, I believe we still _do_ want to warn for two reasons: 1. Trying to access the key via method access is a syntax error. Ruby expects any method ending in `=` to be a 2+-arity method due to the infix notation of setter methods. This is unexpected behavior unless you're very familiar with Ruby parsing. 2. You can still retrieve the key via the normal `Hash#[]` reader, but it prevents setting a similar key without the equal sign. You can see this in the test about setters. I'd say that is unexpected and surprising behavior. Because of these two gotchas, I think we should still warn in cases where you try to set a key that looks like a setter.
* Fix except use in Mash#load (#508)Bobby McDonald2020-01-141-0/+2
|
* Only define compact on ruby >= 2.4Bobby McDonald2020-01-131-0/+1
|
* Suppress `Psych.safe_load` arg warn when using Psych 3.1.0+Koichi ITO2020-01-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This PR suppresses the following `Psych.safe_load` args warn when using Psych 3.1.0 (Ruby 2.6+). ```console % bundle exec rake spec (snip) /Users/koic/src/github.com/intridea/hashie/lib/hashie/extensions/parsers/yaml_erb_parser.rb:22: Passing permitted_classes with the 2nd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, permitted_classes: ...) instead. /Users/koic/src/github.com/intridea/hashie/lib/hashie/extensions/parsers/yaml_erb_parser.rb:22: Passing permitted_symbols with the 3rd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, permitted_symbols: ...) instead. /Users/koic/src/github.com/intridea/hashie/lib/hashie/extensions/parsers/yaml_erb_parser.rb:22: Passing aliases with the 4th argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, aliases: ...) instead ```
* Ensure that Hashie::Arrays are not deconvertedMichael Herold2019-12-131-0/+1
| | | | | | | In order for `#dig` to work properly, we need Arrays to be `Hashie::Array`s to be aware of the key conversion. Our original `Mash#convert_value` method was deconverting `Hashie::Array`s into normal Arrays and causing `#dig` to behave in an unexpected manner.
* Merge pull request #499 from michaelherold/permissive-respond-toBobby McDonald2019-11-181-0/+1
|\ | | | | Add a PermissiveRespondTo extension for Mashes
| * Add a PermissiveRespondTo extension for MashesMichael Herold2019-11-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | By default, Mashes don't state that they respond to unset keys. This causes unexpected behavior when you try to use a Mash with a SimpleDelegator. This new extension allows you create a permissive subclass of Mash that will be fully compatible with SimpleDelegator and allow you to fully do thunk-oriented programming with Mashes. This comes with the trade-off of a ~19KB cache for each of these subclasses and a ~20% performance penalty on any of those subclasses.
* | Merge pull request #467 from michaelherold/deep-merge-bugDaniel Doubrovkine (dB.) @dblockdotorg2019-11-181-0/+1
|\ \ | | | | | | Prevent deep_merge from mutating nested hashes
| * | Prevent deep_merge from mutating nested hashesMichael Herold2019-11-171-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `DeepMerge` extension has two methods of mutating hashes: a destructive one and a non-destructive one. The `#deep_merge` version should not mutate the original hash or any hash nested within it. The `#deep_merge!` version is free to mutate the receiver. Without deeply duplicating the values contained within the hash, the invariant of immutability cannot be held for the original hash. In order to preserve that invariant, we need to introduce a method of deeply duplicating the hash. The trick here is that we cannot rely on a simple call to `Object#dup`. Some classes within the Ruby standard library are not duplicable in particular versions of Ruby. Newer versions of Ruby allow these classes to be "duplicated" in a way that returns the original value. These classes represent value objects, so it is safe to return the original value ... unless the classes are monkey-patched, but that isn't something we can protect against. This implementation does a best-effort to deeply duplicate an entire hash by relying on these value object classes being able to return themselves without violating immutability.
* | Exclude tests from the gem releaseMichael Herold2019-11-171-0/+1
|/ | | | | | | | | | | | | | | | | | | | | When you're installing a gem in a production environment, you want it to install as fast it can. One of the ways you can speed up the installation of the gem is by making it smaller. We currently ship the test suite with the gem, increasing the size of the built gem significantly. By not shipping the test suite, we can shrink the size of the gem by 38%. Below are the measurements I took for that statement. **The size of the gem with the test suite** $ du -b hashie-4.0.1.gem 80384 hashie-4.0.1.gem **The size of the gem without the test suite** $ du -b hashie-4.0.1.gem 50176 hashie-4.0.1.gem
* Update github urls to hashie/hashie (#497)Bobby McDonald2019-11-171-188/+188
| | | | | | | | | | | | | | | | * Update github urls to hashie/hashie * Point omniauth in integration tests at master. Until omniauth releases the changes merged from https://github.com/omniauth/omniauth/pull/977 , we must point at master branch. * revert incorrect change of gem email Co-Authored-By: Michael Herold <github@michaeljherold.com> * Reference open issue for release
* Preparing for next development iteration, 4.0.1.Bobby McDonald2019-10-301-0/+32
|
* Preparing for release, 4.0.0.v4.0.0Bobby McDonald2019-10-301-18/+2
|
* Updated README.mdJean-Francis Bastien2019-10-151-0/+1
| | | | SymbolizeKeys and Keywords argument behavior.
* Allow mash error silencing (#488)Bobby McDonald2019-10-141-1/+2
|
* Make Hashie play nice with Rails 6 Hash#except method (#479)Bobby McDonald2019-10-021-0/+1
|
* Upgrading to 4.0Bobby McDonald2019-08-161-0/+3
|
* Update Travis configs to make jruby builds run on trusty dist.Bobby McDonald2019-08-141-0/+1
|
* Add selective key-conflict warnings for Mash subclasses (#478)Bobby McDonald2019-07-181-0/+1
| | | | | | | | | | | In some cases, you want to be able to ignore Mash warnings for keys that you know you aren't going to access via a method accessor, yet be warned for other keys that you know you might want to access. This change adds the ability to selectively ignore warnings for specific keys instead of globally ignoring the warnings. The change retains the original behavior as well, so if you call `Mash.disable_warnings` without a value it will still globally ignore the warnings.
* Allow options on Mash.load (#474)Daniel Doubrovkine (dB.) @dblockdotorg2019-03-221-0/+1
| | | | | | | | | | | | | | | | | `Mash.load` uses the Ruby standard library to load Yaml-serialized files into a Mash. The original implementation used `YAML.load` for this purpose. However, that method is inherently unsafe so we switched to using `YAML.safe_load`. Safely loading Yaml files has many different domain-specific configuration flags that we did not, by default, expose. This change introduces the ability to configure the safe loading of Yaml files so that all types of Yaml can be loaded when necessary using the flags from the standard library. This implementation preserves the backwards-compatibility with the prior implementation so that it should not require updates from users of the current `Mash.load` behavior. For those who this change affects, we included upgrading documentation to ease the transition.
* Add Hashie::Extensions::Mash::DefineAccessors.Vladimir Kochnev2019-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This patch adds an extension for Mash that makes it behave like `OpenStruct`. It reduces overhead of `method_missing?` magic which is a good thing! It's inspired by the recent @sferik's work on `OpenStruct` — https://github.com/ruby/ruby/pull/1033. When using it in `Mash` subclasses it makes them *remember* methods so then it's more like `ActiveModel` than `OpenStruct` in this case. To use it like `OpenStruct` one could use this shortcut: ```ruby { foo: 1, bar: 2 }.to_mash.with_accessors! ``` Implementation details: It injects to class an anonymous module that stores accessor method definitions. This is inspired by `ActiveModel` / `ActiveRecord`. It allows to override accessors in subclass and call them via `super` if this is intended.
* Do not call any reader attribute in Mash#update if key does not existLaerti Papa2018-10-021-0/+1
| | | | Refs: https://github.com/intridea/hashie/issues/464
* [rubocop] Improve our RuboCop setupMichael Herold2018-09-301-0/+1
| | | | | | | | | | | Disable Metrics/BlockLength in specs because the length of a block in the test suite isn't something we want to lint. We want the tests to be as long as they need to be. Set an explicit line length metric instead of continually updating this as we go. Let's pick a max line length that we want to see and stick with it. This metric should only ever decrease: we don't want to see it ever increase again.
* Fix a regression with aliases on `Mash.load`Michael Herold2018-08-141-0/+1
| | | | | Also, reorganize the test into the existing file and update the changelog.
* Prepare for next development version, v3.6.1Michael Herold2018-08-131-0/+32
|
* Preparing for release, 3.6.0v3.6.0Michael Herold2018-08-131-21/+2
|
* Add MethodOverridingInitializer extensionLucas Nestor2018-08-111-0/+1
|
* Allow Trash to copy properties from othersMichael Herold2018-08-111-0/+1
| | | | | | Trash should be able to copy properties from other properties without causing a problem. Trash should also, when doing this, not set any properties that it doesn't define.
* Update Rubocop and address the addressable todosMichael Herold2018-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | This is a big step forward in our Rubocop setup. I addressed all of the todos from the current version of Rubocop that made sense to. The only things that remain are metrics and one cop that relies on the line length metric to work. I made some judgment calls on disabling a few cops: 1. The `Layout/IndentHeredoc` cop wants you to either use the squiggly heredoc from Ruby 2.3 or introduce a library. Since we are a low-level library that is used as a transitive dependency, we cannot introduce another library as a dependence, so that option is out. Also, we support Rubies back to 2.0 currently, so using the squiggly heredoc isn't an option. Once we remove support for Rubies older than 2.3, we can switch to the squiggly heredoc cop. 2. The `Naming/FileName` cop was reporting false positives for a few files in the repository, so I disabled it on those files. 3. The `Style/DoubleNegation` cop reports lints on a few cases where we use double negation. Given the very generic nature of Hashie, the double-negation is the easiest, clearest way to express that we want an item to be a Boolean. I disabled the cop because we exist in the gray area where this makes sense.
* Fix: NameError (uninitialized constant ↵Takafumi ONAKA2018-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Hashie::Extensions::Parsers::YamlErbParser::Pathname) `Hashie::Mash.load` require `Pathname` since v3.4.5. see: bbafaded9d ``` irb(main):001:0> require "hashie" => true irb(main):002:0> Hashie::Mash.load("foo.yml") Traceback (most recent call last): 6: from /opt/rubies/2.6.0-dev/bin/irb:11:in `<main>' 5: from (irb):2 4: from /Users/onaka/.gem/ruby/2.6.0/gems/hashie-3.5.7/lib/hashie/mash.rb:105:in `load' 3: from /Users/onaka/.gem/ruby/2.6.0/gems/hashie-3.5.7/lib/hashie/extensions/parsers/yaml_erb_parser.rb:19:in `perform' 2: from /Users/onaka/.gem/ruby/2.6.0/gems/hashie-3.5.7/lib/hashie/extensions/parsers/yaml_erb_parser.rb:19:in `new' 1: from /Users/onaka/.gem/ruby/2.6.0/gems/hashie-3.5.7/lib/hashie/extensions/parsers/yaml_erb_parser.rb:9:in `initialize' NameError (uninitialized constant Hashie::Extensions::Parsers::YamlErbParser::Pathname) irb(main):003:0> require "pathname" => true irb(main):004:0> Hashie::Mash.load("foo.yml") => #<Hashie::Mash bar="baz"> ```
* Merge pull request #439 from michaelherold/elasticsearch-integrationDaniel Doubrovkine (dB.) @dblockdotorg2018-02-071-0/+1
|\ | | | | Add an integration spec for Elasticsearch
| * Add an integration spec for ElasticsearchMichael Herold2018-02-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The Elasticsearch gems heavily integrate with Hashie. This leads people to want to use a Mash as the backer for an Elasticsearch model, but the behavior is different than they expect. By having this integration spec, we're covering two things: 1. It might help ensure that we don't break the Elasticsearch ecosystem with changes in Hashie as has happened in the past. 2. It communicates some gotchas that happen with using a Mash as the backer for an Elasticsearch model.
* | Allow codependent Dash attributes to initializeMichael Herold2018-02-061-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Definition: Codependent properties A set of two or more properties who have "required" validations that are based on each other. Example: ```ruby class OneOrMore < Hashie::Dash property :a, required: -> { b.nil? } property :b, required: -> { a.nil? } end ``` When constructing a Dash via the merge initializer, codependent properties have their "required" validation run too early when their values are set to `nil`, which causes an `ArgumentError` to be raised in the case that the first property is set to `nil`. This is an order-dependence bug that is fixed by this commit. By pruning off `nil` values only during initialization via the merge initializer, we can prevent this problem from occurring for the case of `nil` values. However, this is an indication of a larger problem with the architecture of Dash. We should be setting all the properties before running the validations. Rearchitecting this will be quite an undertaking.
* Ensure IndifferentAccess is injected after mergeMichael Herold2018-02-051-0/+1
| | | | | | | | During non-destructive merges (i.e. `#merge`), the `IndifferentAccess` mixin was failing to inject itself into the resulting Hash. This caused a `NoMethodError` to be thrown when attempting to perform the action. Now, we properly inject the mixin when necessary so the `#merge` method works.
* Merge pull request #435 from michaelherold/fix-default-proc-storageDaniel Doubrovkine (dB.) @dblockdotorg2018-02-051-0/+1
|\ | | | | Propagate Mash `default_proc` to sub-Hashes
| * Propagate Mash `default_proc` to sub-HashesMichael Herold2018-02-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case where you want to set deeply nested values through chained calls to the `#[]` method or through method accessors (without using the bang methods), you might set a `default_proc` on a Mash that recursively creates the key as you access it. Previously, the `default_proc` was not being propagated down to sub-Hashes because the way that `#dup` was written wasn't passing the `default_proc` do the duplicated object. Now, the `default_proc` is correctly being sent to the duplicated object, which allows this pattern to work: ```ruby h = Hashie::Mash.new { |mash, key| mash[key] = mash.class.new(&mash.default_proc) } h.a.b.c = :xyz h[:a][:b][:c] #=> :xyz h[:x][:y][:z] = :abc h.x.y.z #=> :abc ```
* | Add documentation for Mash subclassesMichael Herold2018-02-041-0/+1
|/ | | | | | | | | The behavior of Mash subclasses around the wrapping of inner sub-Hashes can be confusing, so we should have some documentation around it. This captures the process of subclasses wrapping their sub-Hashes in a guided fashion. Also, this reorganizes a bit of the Mash readme to group related topics together under headlines.
* Preparing for next development iteration, 3.5.8Michael Herold2017-12-191-0/+32
|