pseudocephalopod 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source :gemcutter
2
2
 
3
3
  # Setup gems
4
4
  gem "activerecord", "= 3.0.0.beta4"
5
+ gem "mongoid", ">= 2.0.0.beta"
5
6
  gem "reversible_data"
6
7
  gem "uuid"
7
8
  gem "sqlite3-ruby", :require => "sqlite3"
@@ -73,7 +73,7 @@ module Pseudocephalopod
73
73
  end
74
74
 
75
75
  def slug_scope_relation(record)
76
- has_slug_scope? ? where(slug_scope => record.send(slug_scope)) : unscoped
76
+ has_slug_scope? ? where(slug_scope => record.send(slug_scope)) : self
77
77
  end
78
78
 
79
79
  protected
@@ -6,7 +6,7 @@ module Pseudocephalopod
6
6
  end
7
7
 
8
8
  def other_than(record)
9
- record.new_record? ? unscoped : where("#{quoted_table_name}.id != ?", record.id)
9
+ record.new_record? ? self : where("#{quoted_table_name}.id != ?", record.id)
10
10
  end
11
11
 
12
12
  end
@@ -2,7 +2,7 @@ module Pseudocephalopod
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 4
5
+ PATCH = 5
6
6
  STRING = [MAJOR, MINOR, PATCH].join(".")
7
7
  end
8
8
  end
@@ -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
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pseudocephalopod}
8
- s.version = "0.2.4"
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-06-11}
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
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-06-11 00:00:00 +08:00
18
+ date: 2010-09-05 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency