pseudocephalopod 0.2.4 → 0.2.5
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.
- data/Gemfile +1 -0
- data/lib/pseudocephalopod/active_record_methods.rb +1 -1
- data/lib/pseudocephalopod/scopes.rb +1 -1
- data/lib/pseudocephalopod/version.rb +1 -1
- data/lib/pseudocephalopod.rb +18 -18
- data/pseudocephalopod.gemspec +2 -2
- metadata +4 -4
data/Gemfile
CHANGED
data/lib/pseudocephalopod.rb
CHANGED
|
@@ -8,15 +8,15 @@ require 'active_support/concern'
|
|
|
8
8
|
|
|
9
9
|
module Pseudocephalopod
|
|
10
10
|
extend ActiveSupport::Autoload
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
mattr_accessor :cache_key_prefix, :cache
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
class << self
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
def with_counter(prefix, counter = 0)
|
|
17
17
|
counter < 1 ? prefix : "#{prefix}--#{counter}"
|
|
18
18
|
end
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
def next_value(scope, prefix)
|
|
21
21
|
counter = 0
|
|
22
22
|
slug = self.with_counter(prefix, counter)
|
|
@@ -26,31 +26,31 @@ module Pseudocephalopod
|
|
|
26
26
|
end
|
|
27
27
|
slug
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
def uuid
|
|
31
31
|
@uuid ||= UUID.new
|
|
32
32
|
end
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
def generate_uuid_slug
|
|
35
35
|
uuid.generate
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
def last_known_slug_id(scope, slug)
|
|
39
39
|
Pseudocephalopod::Slug.id_for(Pseudocephalopod.key_for_scope(scope), slug)
|
|
40
40
|
end
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
def record_slug(record, slug)
|
|
43
43
|
Pseudocephalopod::Slug.record_slug(record, slug)
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
def previous_slugs_for(record)
|
|
47
47
|
Pseudocephalopod::Slug.previous_for(record)
|
|
48
48
|
end
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
def remove_slug_history_for(record)
|
|
51
51
|
Pseudocephalopod::Slug.remove_history_for(record)
|
|
52
52
|
end
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
def key_for_scope(scope)
|
|
55
55
|
if scope.respond_to?(:slug_scope_key)
|
|
56
56
|
scope.slug_scope_key
|
|
@@ -60,21 +60,21 @@ module Pseudocephalopod
|
|
|
60
60
|
scope.to_s
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
end
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
self.cache_key_prefix ||= "cached-slugs"
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
autoload :Caching
|
|
69
69
|
autoload :Scopes
|
|
70
70
|
autoload :Finders
|
|
71
71
|
autoload :SlugHistory
|
|
72
72
|
autoload :Slug
|
|
73
73
|
autoload :MemoryCache
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
require 'pseudocephalopod/active_record_methods'
|
|
76
76
|
ActiveRecord::Base.extend Pseudocephalopod::ActiveRecordMethods
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
require 'pseudocephalopod/railtie' if defined?(Rails::Railtie)
|
|
79
|
-
|
|
80
|
-
end
|
|
79
|
+
|
|
80
|
+
end
|
data/pseudocephalopod.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{pseudocephalopod}
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.5"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Darcy Laycock"]
|
|
12
|
-
s.date = %q{2010-
|
|
12
|
+
s.date = %q{2010-09-05}
|
|
13
13
|
s.description = %q{Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history}
|
|
14
14
|
s.email = %q{sutto@sutto.net}
|
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pseudocephalopod
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 29
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 5
|
|
10
|
+
version: 0.2.5
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Darcy Laycock
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-
|
|
18
|
+
date: 2010-09-05 00:00:00 +08:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|