reloader_interceptor 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f38b4d1966eb68ac82bb3f0e2a54b0f3838aae47b3b0ebd63dbd1cda4595a680
4
- data.tar.gz: f039be6691bf07498be7a7828398ffae6975df1a2eced716df74e29e0294bd1a
3
+ metadata.gz: 61ba3f1dd180dd43eb74aa60dd40f76484d467d8ffa2c5b056819ba59ad819a8
4
+ data.tar.gz: 8e9462708b474cd6f1c72f74fd313fe3d8cffa35ea8b943672577ad0dfccebb3
5
5
  SHA512:
6
- metadata.gz: ff4697f459848a0c520c98c42b9910cd3f2d6d800fd95675840db70dea7ec33ccb931a742ab0daad0b27999dc3f51e0c969e060d14123ffa6d7c4aa097eca1af
7
- data.tar.gz: 2e717dc1d1df328f50b3267217690ac322fa35288acd5703f5f06bd54ee9c7d0f87bc34d25b5066ec47d509e03ef4ff3a04bd6fed4cb87809097740adaee594b
6
+ metadata.gz: 0fa7eb19c0ad9d5780175a4aae8c45ec7c959c7ab4cf830ed6231db49cd0796d1b6b49f58d90260ca407a971892bf39bdac5562d8f609a3e9386f7b37203a019
7
+ data.tar.gz: 72c86a51df465cef2151ab7c4d44ef7714b68e02f3b297bc19aca85ca2e8368f00921ac010f4db0f2b8f1be2d4c6c3669534edc3d42a75e9accdbe4426ce3107
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reloader_interceptor (0.0.1)
4
+ reloader_interceptor (0.0.2)
5
5
  activesupport
6
6
  grpc
7
7
 
@@ -1,3 +1,4 @@
1
+ require "active_support"
1
2
  require_relative "./reloader_interceptor/version"
2
3
  require_relative "./reloader_interceptor/server_interceptor"
3
4
  require_relative "./reloader_interceptor/wrapper"
@@ -6,6 +7,7 @@ module ReloaderInterceptor
6
7
  @enabled = true # Enabled by default
7
8
 
8
9
  class << self
10
+ # @return [bool]
9
11
  def enabled?
10
12
  @enabled
11
13
  end
@@ -18,6 +20,20 @@ module ReloaderInterceptor
18
20
  @enabled = false
19
21
  end
20
22
 
21
- attr_writer :enabled
23
+ # @return [Class] A class which inherits ActiveSupport::Executor
24
+ def executor
25
+ reloader.executor
26
+ end
27
+
28
+ # @return [Class] A class which inherits ActiveSupport::Reloader
29
+ def reloader
30
+ @reloader ||= begin
31
+ r = Class.new(ActiveSupport::Reloader)
32
+ r.executor = Class.new(ActiveSupport::Executor)
33
+ r
34
+ end
35
+ end
36
+
37
+ attr_writer :enabled, :reloader
22
38
  end
23
39
  end
@@ -2,18 +2,25 @@ require "grpc"
2
2
 
3
3
  module ReloaderInterceptor
4
4
  class ServerInterceptor < GRPC::ServerInterceptor
5
- def initialize(reloader:)
5
+ # @param [Class, nil] reloader A class which inherits ActiveSupport::Reloader
6
+ def initialize(reloader: nil)
6
7
  @reloader = reloader
7
8
  end
8
9
 
9
10
  def request_response(request:, call:, method:, &block)
10
11
  return yield unless ReloaderInterceptor.enabled?
11
12
 
12
- @reloader.wrap do
13
+ reloader.wrap do
13
14
  yield
14
15
  end
15
16
  end
16
17
 
17
18
  # NOTE: For now, we don't support server_streamer, client_streamer and bidi_streamer
19
+
20
+ private
21
+
22
+ def reloader
23
+ @reloader || ReloaderInterceptor.reloader
24
+ end
18
25
  end
19
26
  end
@@ -1,3 +1,3 @@
1
1
  module ReloaderInterceptor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reloader_interceptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nao Minami