mongoid-urls 0.0.9 → 0.3.0

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
  SHA1:
3
- metadata.gz: 025093f44d0ac503c479d29b060fbdc6b02bce2d
4
- data.tar.gz: 047fde3fdbb3ce920d3ecfb0fc10edf7014d25c9
3
+ metadata.gz: dd5628f83716f42ffc44d2c84383340e2115dc03
4
+ data.tar.gz: 8ed9a3ae49d8f57f79451c6ad53726fa2fd98bc8
5
5
  SHA512:
6
- metadata.gz: 516d37fffdfc84b839498510a5160532aaf34697718cc095f29362ef895b0378d69163b42a9c02830aaac466ed70728455471fbcf988426ec3458ddd26dfd1ed
7
- data.tar.gz: aca47cb090d946b6436f18abec6bb9947e3a94f576a7045273e2d06bab2ea39171eb536b54989df0f3e84edbe4cf01abece67038657bb93beefd95cab32789b7
6
+ metadata.gz: d98d50479fb45a7a88c0757957facb34c285ac04f4757d6dfccc2a0b0d589a18606347f105ac26f805aa522cd967ed47100cc4494ac8a2e5db5a8d4545b1916f
7
+ data.tar.gz: f278f8f0f40b51113ba87c5e192a340ceb213e2332f96b04adb765ec6d9b71886f36b40949459b3a72cfbb19e00d55d883cde9b9e0430ab5f41566ab16ce31c6
@@ -1,6 +1,6 @@
1
1
  module Mongoid
2
2
  # Mongoid::Urls::VERSION
3
3
  module Urls
4
- VERSION = '0.0.9'
4
+ VERSION = '0.3.0'.freeze
5
5
  end
6
6
  end
data/lib/mongoid/urls.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'mongoid'
2
- require 'babosa'
3
2
 
4
3
  module Mongoid
5
4
  # Creates friendly urls for mongoid models!
@@ -24,7 +23,7 @@ module Mongoid
24
23
  #
25
24
  def url(*args)
26
25
  options = args.extract_options!
27
- fail 'One #url per model!' if url_keys
26
+ raise 'Only one #url per model!' if url_keys
28
27
  self.url_keys = args # .first.to_s
29
28
  self.url_simple = options[:simple]
30
29
  create_url_fields
@@ -45,7 +44,8 @@ module Mongoid
45
44
  rescue Mongoid::Errors::DocumentNotFound
46
45
  nil
47
46
  end
48
- alias_method :find_by_url, :find_url
47
+
48
+ alias find_by_url find_url
49
49
 
50
50
  private
51
51
 
@@ -53,7 +53,7 @@ module Mongoid
53
53
  field :url, type: String
54
54
  index({ url: 1 }, unique: true)
55
55
  define_method('url=') do |val|
56
- self[:url] = val.to_slug.normalize.to_s
56
+ self[:url] = val.parameterize
57
57
  end
58
58
  return if url_simple
59
59
  field :urls, type: Array, default: []
@@ -69,7 +69,7 @@ module Mongoid
69
69
  url_keys.each do |key|
70
70
  val = send(key)
71
71
  next if val.blank?
72
- url = val.to_slug.normalize.to_s
72
+ url = val.parameterize
73
73
  next if self.class.find_url(url)
74
74
  return url
75
75
  end
data/mongoid-urls.gemspec CHANGED
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
2
  require 'mongoid/urls/version'
4
3
 
@@ -13,8 +12,9 @@ Gem::Specification.new do |s|
13
12
  s.license = 'MIT'
14
13
 
15
14
  s.rubyforge_project = 'mongoid-urls'
15
+
16
16
  s.add_dependency 'mongoid', '> 4.0.0'
17
- s.add_dependency 'babosa', '> 1.0.0'
17
+ s.add_dependency 'activesupport', '> 4.0.0'
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -24,7 +24,7 @@ describe Mongoid::Urls do
24
24
  describe '#url' do
25
25
  before(:each) { document_class.send(:url, :title) }
26
26
  it 'should slugize a few stuff' do
27
- expect(document.url).to eq('im-a-document')
27
+ expect(document.url).to eq('i-m-a-document')
28
28
  end
29
29
 
30
30
  it 'should update url' do
@@ -37,7 +37,7 @@ describe Mongoid::Urls do
37
37
  article.save
38
38
  article.title = 'Hello Ruby!'
39
39
  article.save
40
- expect(article.urls).to eq ['im-an-article', 'hello-ruby']
40
+ expect(article.urls).to eq ['i-m-an-article', 'hello-ruby']
41
41
  end
42
42
  end
43
43
 
@@ -126,7 +126,7 @@ describe Mongoid::Urls do
126
126
 
127
127
  it 'should create the urls after being saved' do
128
128
  article.save
129
- expect(article.urls).to eq ['im-an-article']
129
+ expect(article.urls).to eq ['i-m-an-article']
130
130
  end
131
131
  end
132
132
 
@@ -175,7 +175,7 @@ describe Mongoid::Urls do
175
175
  describe '.to_param' do
176
176
  it 'should respond with last valid url' do
177
177
  document_class.send(:url, :title)
178
- expect(document.to_param).to eq 'im-a-document'
178
+ expect(document.to_param).to eq 'i-m-a-document'
179
179
  end
180
180
  end
181
181
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-urls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Piccinini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-25 00:00:00.000000000 Z
11
+ date: 2016-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: babosa
28
+ name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: 4.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: 4.0.0
41
41
  description: Mongoid Urls creates unique sanitized URLs for Mongoid documents. Simple
42
42
  and great for making URLs look good.
43
43
  email:
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project: mongoid-urls
83
- rubygems_version: 2.4.8
83
+ rubygems_version: 2.6.6
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: A url sanitizer (slugs) for Mongoid documents.
@@ -88,4 +88,3 @@ test_files:
88
88
  - spec/mongoid/urls_spec.rb
89
89
  - spec/spec_helper.rb
90
90
  - spec/support/models.rb
91
- has_rdoc: