minato-rails-auth 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/minato/rails/auth/jwt.rb +2 -0
- data/lib/minato/rails/auth/version.rb +1 -1
- data/lib/object_hash.rb +10 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9c9ae3638648d8a758dc1b651d29889d03a750d7976923c9e2cd0abfe8f31d5
|
4
|
+
data.tar.gz: 7e70a4134521be3283aa9b4d7b55c13fa641e521ffcfd983539d35860d97d777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50c308ceff9be12a49e6ce924e86aca424bf6169f85b4d553827aaebca64e4474a9c41c7649098eca041f6a90c2ac691a9e761aedf96b453a5839da8b3d6811a
|
7
|
+
data.tar.gz: 0443ab1086d699acad7de5fb4c1252af3d593ed2032121672f64848616570071222bd7c33a4de6b79f3fca5eff4eb70ac212778fd2649933855efad7067f23a5
|
data/README.md
CHANGED
@@ -104,7 +104,7 @@ To add the JWT authentication system in your Rails application, just follow the
|
|
104
104
|
- This works like the `.machine?` method, but tells you if the client is human.
|
105
105
|
|
106
106
|
- `.session`
|
107
|
-
- This returns a
|
107
|
+
- This returns a object containing the JWT payload, if the client is human.
|
108
108
|
|
109
109
|
- `.machine`
|
110
110
|
- This returns a string with the machine name, when the client is a machine.
|
data/lib/object_hash.rb
CHANGED
@@ -6,12 +6,14 @@ class ObjectHash
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def method_missing(name)
|
9
|
-
find_hash_value(name)
|
9
|
+
value = find_hash_value(name)
|
10
|
+
define_singleton_method(name) { value }
|
11
|
+
value
|
10
12
|
end
|
11
13
|
|
12
|
-
def respond_to_missing?(name,
|
13
|
-
return true if @hash.
|
14
|
-
return true if @hash.
|
14
|
+
def respond_to_missing?(name, _include_private = false)
|
15
|
+
return true if @hash.key?(name.to_sym)
|
16
|
+
return true if @hash.key?(name.to_s)
|
15
17
|
|
16
18
|
super
|
17
19
|
end
|
@@ -19,12 +21,12 @@ class ObjectHash
|
|
19
21
|
private
|
20
22
|
|
21
23
|
def find_hash_value(name)
|
22
|
-
value = @hash
|
23
|
-
return ObjectHash.new(value) if value.
|
24
|
+
value = @hash.fetch(name.to_sym, nil) || @hash.fetch(name.to_s, nil)
|
25
|
+
return ObjectHash.new(value) if value.is_a?(Hash)
|
24
26
|
|
25
|
-
if value.
|
27
|
+
if value.is_a?(Array)
|
26
28
|
return value.map do |item|
|
27
|
-
next ObjectHash.new(item) if item.
|
29
|
+
next ObjectHash.new(item) if item.is_a?(Hash)
|
28
30
|
|
29
31
|
item
|
30
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minato-rails-auth
|
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
|
- Ferreri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|