activekit 0.2.1 → 0.2.3.dev1

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: 67eb8f62ef1b3e4f6532c5431730922130158646b4067ed14511314777d18448
4
- data.tar.gz: 11d7429b7011c2aca230935789489c4ac6828ff60e4cb250fe18910fd14d2daf
3
+ metadata.gz: fdfebffac9f65f7b8e393240aebefc53bb56d46a1eaff8070837735adf269e99
4
+ data.tar.gz: 331f0bef2a0675a603bf462885b7bf0c47a5acca2efcc8a59db8150555183bdd
5
5
  SHA512:
6
- metadata.gz: 63885175b26d2bace31dd3ded154ab4631819645f4c2cc41653e57179968f03149f2f352c399c9693bb69bbc476e322f3c7ef67e9e4f159e956111bc478fde7c
7
- data.tar.gz: fdd159ca5f30a970452036b5d8fd8eb384466dc908c166b7873144a2cee0f3c6cd8b671b23813db22073b389dbb916469576c8eef3cd0a44d1ca80e844507372
6
+ metadata.gz: f814ff88427a48347b5272a7cec69997fed42d5910a9fa708fdd45b7e19957ebd6df5b1d0a12d025bcd7bf65d99e630aa2ed879ac7b3e5c50ddbf043c7bcdf55
7
+ data.tar.gz: b79dc6fa0fd3d62e7f03fe0e69426969d77380614e4c3b64a1fec5c21162ae7440a4fc23d2af922370474ad8dc4a6b38ed615c0dc2f3425349ef7138a426e03f
@@ -3,6 +3,10 @@ module ActiveKit
3
3
  isolate_namespace ActiveKit
4
4
  config.eager_load_namespaces << ActiveKit
5
5
 
6
+ initializer "active_kit.add_middleware" do |app|
7
+ app.middleware.use ActiveKit::Middleware
8
+ end
9
+
6
10
  initializer "active_kit.activekitable" do
7
11
  require "active_kit/activekitable"
8
12
 
@@ -1,5 +1,8 @@
1
1
  module ActiveKit
2
2
  module Loader
3
+ def self.ensure_middleware_for!(request:)
4
+ end
5
+
3
6
  def self.ensure_setup_for!(current_class:)
4
7
  current_class.class_eval do
5
8
  unless self.reflect_on_association :activekit_association
@@ -0,0 +1,24 @@
1
+ module ActiveKit
2
+ class Middleware
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ # Middleware that determines which ActiveKit schedules to run.
8
+ def call(env)
9
+ request = ActionDispatch::Request.new(env)
10
+
11
+ activekit_runner(request) do
12
+ @app.call(env)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def activekit_runner(request, &blk)
19
+ ActiveKit::Loader.ensure_middleware_for!(request: request)
20
+
21
+ yield
22
+ end
23
+ end
24
+ end
@@ -52,7 +52,7 @@ module ActiveKit
52
52
  after_save :activekit_sequence_sequenceable_callback
53
53
  after_destroy :activekit_sequence_sequenceable_callback
54
54
 
55
- private def activekit_sequence_sequenceable_callback
55
+ define_method :activekit_sequence_sequenceable_callback do
56
56
  inverse_assoc = self.class.search_inverse_assoc(self, updater_on)
57
57
  position = positioning_method ? self.public_send(positioning_method) : nil
58
58
  if inverse_assoc.respond_to?(:each)
@@ -62,6 +62,7 @@ module ActiveKit
62
62
  end
63
63
  logger.info "ActiveSequence - Sequencing from #{self.class.name}: Done."
64
64
  end
65
+ private :activekit_sequence_sequenceable_callback
65
66
  end
66
67
  end
67
68
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveKit
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.3.dev1'
3
3
  end
data/lib/active_kit.rb CHANGED
@@ -6,6 +6,7 @@ module ActiveKit
6
6
 
7
7
  autoload :Activekiter
8
8
  autoload :Loader
9
+ autoload :Middleware
9
10
  autoload :Relation
10
11
  autoload :Sequence
11
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activekit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3.dev1
5
5
  platform: ruby
6
6
  authors:
7
7
  - plainsource
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-17 00:00:00.000000000 Z
11
+ date: 2023-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,6 +56,7 @@ files:
56
56
  - lib/active_kit/activekiter.rb
57
57
  - lib/active_kit/engine.rb
58
58
  - lib/active_kit/loader.rb
59
+ - lib/active_kit/middleware.rb
59
60
  - lib/active_kit/relation.rb
60
61
  - lib/active_kit/sequence.rb
61
62
  - lib/active_kit/sequence/sequence.rb
@@ -80,9 +81,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
81
  version: '0'
81
82
  required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  requirements:
83
- - - ">="
84
+ - - ">"
84
85
  - !ruby/object:Gem::Version
85
- version: '0'
86
+ version: 1.3.1
86
87
  requirements: []
87
88
  rubygems_version: 3.1.2
88
89
  signing_key: