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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f230a5cc5a2ed2896b958555a3d1df46afdb1ff882d7a781b98415e91c47bf31
4
- data.tar.gz: c0cda43ffd8b1385efb1fcfba78fd04dece987e19c9882b3b82b9e75b9096fa3
3
+ metadata.gz: d9c9ae3638648d8a758dc1b651d29889d03a750d7976923c9e2cd0abfe8f31d5
4
+ data.tar.gz: 7e70a4134521be3283aa9b4d7b55c13fa641e521ffcfd983539d35860d97d777
5
5
  SHA512:
6
- metadata.gz: 889f2d69ba35ebdea6e1ff24f2d278977ba907b294678955afc2af748092716c361311914ef2f8e4617e0846d09f405a1675832da9c222ff6989dc3bf78f2da8
7
- data.tar.gz: aaeb0db38de916e67427c617325ff610020155ec4a659ccb6de393f79a2fc4d11d81151efb53bc418f27922a7b15fa8391878982f639910162b8a78b30f3f9ff
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 hash with the JWT payload, if the client is human.
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.
@@ -14,6 +14,8 @@ module Minato
14
14
  module JWT
15
15
  extend ActiveSupport::Concern
16
16
 
17
+ attr_reader :current_user
18
+
17
19
  private
18
20
 
19
21
  def authenticate_request!
@@ -3,7 +3,7 @@
3
3
  module Minato
4
4
  module Rails
5
5
  module Auth
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.1'
7
7
  end
8
8
  end
9
9
  end
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, include_private = false)
13
- return true if @hash.keys.include?(name.to_s)
14
- return true if @hash.keys.include?(name.to_sym)
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[name.to_s] || @hash[name.to_sym]
23
- return ObjectHash.new(value) if value.instance_of?(Hash)
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.instance_of?(Array)
27
+ if value.is_a?(Array)
26
28
  return value.map do |item|
27
- next ObjectHash.new(item) if item.instance_of?(Hash)
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2024-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport