activekit 0.1.2 → 0.1.3

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: f22601f05c64e21478512fd85ac1ebf74afc91c517349793fc79bfad4f343952
4
- data.tar.gz: 3ed1dcb02993f21dd6cb582b2574652eb34a5107e4d70c456ba047391294a908
3
+ metadata.gz: cf28e084bf1e87d21b36b3abcce5f3ebc902595a9635396f985c3935467e6b48
4
+ data.tar.gz: ee2abf2cd217e523b35aa980dfa84072dee883dde5a2a782f864453740448321
5
5
  SHA512:
6
- metadata.gz: 78245200325e89c2a78a83123c2874bb9163d2202fdf9719b62f60d9986274a6ddb9e1700801cb2d7be896aaff90d782f79e43c9e6681c8720192e14e4738acd
7
- data.tar.gz: d770761da113c6f859e04250a980f3c4416ff142702ab2f97b88ca32bc063cb4f32e9967e0fa2c2b4deac10e5d4d63c392e00c5462f31a586aefa355b3f87918
6
+ metadata.gz: f9848ed64694d379141ab41865234ac80f6042452be9a3a34ee2f94db61fa7a9c4e3bd564fb85c6029bd7e86379e773fc5b3945a7676ea4955489cd325a72bd4
7
+ data.tar.gz: 8724f2eb4848df56dd589ad04e241c8a95a47d27b80e2d3c7bc1838f4b02a76e726115c27c03f449699c40ca34c8f50667254b1056408dea42bf02e5aafa5bc0
@@ -2,6 +2,8 @@ module ActiveKit
2
2
  class Attribute < ApplicationRecord
3
3
  belongs_to :record, polymorphic: true
4
4
 
5
+ store :value, accessors: [ :sequence ], coder: JSON
6
+
5
7
  validates :value, presence: true, length: { maximum: 1073741823, allow_blank: true }
6
8
  end
7
9
  end
@@ -0,0 +1,15 @@
1
+ require 'active_support/concern'
2
+ require "active_kit/sequence/sequenceable"
3
+
4
+ module ActiveKit
5
+ module Activekitable
6
+ extend ActiveSupport::Concern
7
+ include ActiveKit::Sequence::Sequenceable
8
+
9
+ included do
10
+ end
11
+
12
+ class_methods do
13
+ end
14
+ end
15
+ end
@@ -3,11 +3,13 @@ module ActiveKit
3
3
  isolate_namespace ActiveKit
4
4
  config.eager_load_namespaces << ActiveKit
5
5
 
6
- initializer "active_kit.sequence" do
7
- require "active_kit/sequence/sequenceable"
6
+ initializer "active_kit.activekitable" do
7
+ require "active_kit/activekitable"
8
8
 
9
9
  ActiveSupport.on_load(:active_record) do
10
- include ActiveKit::Sequence::Sequenceable
10
+ include ActiveKit::Activekitable
11
+
12
+ has_one :activekit, as: :record, dependent: :destroy, class_name: "ActiveKit::Attribute"
11
13
  end
12
14
  end
13
15
  end
@@ -24,27 +24,18 @@ module ActiveKit
24
24
 
25
25
  unless self.respond_to?(:sequencer)
26
26
  define_singleton_method :sequencer do
27
- @sequencer ||= ActiveSequence::Sequencer.new(current_class: self)
27
+ @sequencer ||= ActiveKit::Sequence::Sequencer.new(current_class: self)
28
28
  end
29
29
 
30
- has_many :sequence_attributes, as: :record, dependent: :destroy, class_name: "ActiveSequence::Attribute"
31
30
  # scope :order_sequence, -> (options_hash) { includes(:sequence_attributes).where(sequence_attributes: { name: name.to_s }).order("sequence_attributes.value": :asc) }
32
31
  end
33
32
 
34
- set_active_sequence_create_callbacks(attribute_name: name)
35
- set_active_sequence_commit_callbacks(attribute_name: name, positioning_method: positioning_method, updater: options.delete(:updater))
33
+ set_active_sequence_callbacks(attribute_name: name, positioning_method: positioning_method, updater: options.delete(:updater))
36
34
 
37
35
  sequencer.add_attribute(name: name, options: options)
38
36
  end
39
37
 
40
- def set_active_sequence_create_callbacks(attribute_name:)
41
- before_create do
42
- self.sequence_attributes.find_or_initialize_by(name: attribute_name)
43
- logger.info "ActiveSequence - Creating Sequence attribute '#{attribute}' from #{self.class.name}: Done."
44
- end
45
- end
46
-
47
- def set_active_sequence_commit_callbacks(attribute_name:, positioning_method:, updater:)
38
+ def set_active_sequence_callbacks(attribute_name:, positioning_method:, updater:)
48
39
  updater = updater || {}
49
40
 
50
41
  if updater.empty?
@@ -0,0 +1,8 @@
1
+ module ActiveKit
2
+ module Sequence
3
+ extend ActiveSupport::Autoload
4
+
5
+ autoload :Sequencer
6
+ autoload :Wordbook
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveKit
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/lib/active_kit.rb CHANGED
@@ -4,6 +4,5 @@ require "active_kit/engine"
4
4
  module ActiveKit
5
5
  extend ActiveSupport::Autoload
6
6
 
7
- autoload :Sequencer, "active_kit/sequence/sequencer"
8
- autoload :Wordbook, "active_kit/sequence/wordbook"
7
+ autoload :Sequence
9
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activekit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - plainsource
@@ -52,7 +52,9 @@ files:
52
52
  - config/routes.rb
53
53
  - db/migrate/20231016050208_create_active_kit_attributes.rb
54
54
  - lib/active_kit.rb
55
+ - lib/active_kit/activekitable.rb
55
56
  - lib/active_kit/engine.rb
57
+ - lib/active_kit/sequence.rb
56
58
  - lib/active_kit/sequence/sequenceable.rb
57
59
  - lib/active_kit/sequence/sequencer.rb
58
60
  - lib/active_kit/sequence/wordbook.rb