my_hash_diff_alex 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/my_hash_diff.rb +9 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f4130da1b5f49d4cd0123053b43d82f845fec648a842cc1330d41c159d5cff50
4
+ data.tar.gz: 27cbb12ec13290f680c18960fcd19df4fd2d20c97d014963dbc77b13997d4aaa
5
+ SHA512:
6
+ metadata.gz: 2e34ec6d3e205b5d0300a643ecfeef31848d8a96fab02f5909cd63dbb6a4bf2198db7d65567b022a6adbb9cdc496cf86bc50b7a9d22cfc72a542d32299aeeea8
7
+ data.tar.gz: 4b22653bf6285f57c7290e08dfcb5ea570a68ec711bfc0cb6a4807e96b8739ef0fa67e910a36e37753f4c9f47e27f273966185279718b9a39e751ddea7724b5a
@@ -0,0 +1,9 @@
1
+ class Hash
2
+ def my_diff(hash)
3
+ result = {}
4
+ self.keys.each do |key|
5
+ result[key] = self.fetch(key) unless hash.keys.include?(key) && hash.fetch(key) == self.fetch(key)
6
+ end
7
+ result
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: my_hash_diff_alex
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Ionas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-01-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Returns the difference between self (hash) and a hash given as a parameter
14
+ email: ionas.alex319@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/my_hash_diff.rb
20
+ homepage: https://rubygems.org/gems/my_hash_diff
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.5.3
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Diff on hashes
43
+ test_files: []