key_mirror-ruby 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/key_mirror/version.rb +1 -1
- data/lib/key_mirror.rb +5 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 494e8bc5d2a7a5a89836b5e399c1aeed0fb2f11bae261f3044243db13fa6e10c
|
4
|
+
data.tar.gz: 794a035d8acfc2332b4ef0b5ec3ebcca3ecdcb9fe80fcbdf8a2cab27ba4d74ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dca4073244c2d0aac8947c6924f248cb75ceda153712ef7bb7803c0c353a06cb96a040d1f15935185fc32ada3e50ca49a05bd9595685f2e1caa72f12eb8b71dc
|
7
|
+
data.tar.gz: f36eeb50dbc4ddaadadf1a3ea5b80ade975023cef40627c6f6a970d972b87551a1f3effd86e2d35d7f7381741487c7160cb8dd02c4b1eee2b7c46c48cbace845
|
data/README.md
CHANGED
@@ -26,6 +26,9 @@ require 'key_mirror'
|
|
26
26
|
|
27
27
|
mirrored_key_hash = KeyMirror.({ hello: nil, 'world' => nil })
|
28
28
|
# => { hello: 'hello', 'world' => 'world' }
|
29
|
+
|
30
|
+
mirrored_key_hash = KeyMirror.(%i[hello world])
|
31
|
+
# => { hello: 'hello', world: 'world' }
|
29
32
|
```
|
30
33
|
|
31
34
|
## Development
|
@@ -38,7 +41,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
38
41
|
|
39
42
|
Bug reports and pull requests are welcome on GitHub at https://github.com/the-spectator/key_mirror-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/the-spectator/key_mirror-ruby/blob/master/CODE_OF_CONDUCT.md).
|
40
43
|
|
41
|
-
|
42
44
|
## License
|
43
45
|
|
44
46
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/key_mirror/version.rb
CHANGED
data/lib/key_mirror.rb
CHANGED
@@ -5,7 +5,7 @@ require "key_mirror/version"
|
|
5
5
|
module KeyMirror
|
6
6
|
class ArgumentError < StandardError
|
7
7
|
def initialize
|
8
|
-
super("argument must be a Hash")
|
8
|
+
super("argument must be a Hash or Array")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -15,10 +15,11 @@ module KeyMirror
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.call(
|
19
|
-
|
18
|
+
def self.call(obj)
|
19
|
+
hash = {}
|
20
|
+
raise KeyMirror::ArgumentError.new unless obj.is_a?(Hash) || obj.is_a?(Array)
|
20
21
|
|
21
|
-
|
22
|
+
obj.each do |key, _|
|
22
23
|
raise KeyMirror::KeyError unless key.is_a?(String) || key.is_a?(Symbol)
|
23
24
|
|
24
25
|
hash[key] = key.to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: key_mirror-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akshay Birajdar
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: key_mirror ruby is a simple ruby helper which returns hash with values
|
14
14
|
equal to stringified keys.
|
@@ -28,7 +28,7 @@ licenses:
|
|
28
28
|
metadata:
|
29
29
|
homepage_uri: https://github.com/the-spectator/keymirror-ruby
|
30
30
|
source_code_uri: https://github.com/the-spectator/keymirror-ruby
|
31
|
-
post_install_message:
|
31
|
+
post_install_message:
|
32
32
|
rdoc_options: []
|
33
33
|
require_paths:
|
34
34
|
- lib
|
@@ -43,8 +43,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
|
-
rubygems_version: 3.
|
47
|
-
signing_key:
|
46
|
+
rubygems_version: 3.4.12
|
47
|
+
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Ruby implementation for JS keyMirror library
|
50
50
|
test_files: []
|