vidibus-permalink 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Vidibus::Permalink
1
+ # Vidibus::Permalink [![](http://travis-ci.org/vidibus/vidibus-permalink.png)](http://travis-ci.org/vidibus/vidibus-permalink) [![](http://stillmaintained.com/vidibus/vidibus-permalink.png)](http://stillmaintained.com/vidibus/vidibus-permalink)
2
2
 
3
3
  This gem allows changeable permalinks. That may be an oxymoron, but it's really useful from a SEO perspective.
4
4
 
@@ -52,7 +52,7 @@ module Vidibus
52
52
 
53
53
  # Returns permalink scope.
54
54
  def permalink_scope
55
- @permalink_scope ||= self.class.permalink_options[:scope]
55
+ @permalink_scope ||= get_scope
56
56
  end
57
57
 
58
58
  def find_or_initialize(value, scope)
@@ -62,6 +62,25 @@ module Vidibus
62
62
 
63
63
  private
64
64
 
65
+ def get_scope
66
+ scope = self.class.permalink_options[:scope]
67
+ return unless scope
68
+
69
+ {}.tap do |hash|
70
+ scope.each do |key, value|
71
+ if value.kind_of?(String)
72
+ hash[key] = value
73
+ elsif value.kind_of?(Symbol) && respond_to?(value)
74
+ hash[key] = send(value)
75
+ else
76
+ raise PermalinkConfigurationError.new(
77
+ %Q{No scope value for key "#{key}" found.}
78
+ )
79
+ end
80
+ end
81
+ end
82
+ end
83
+
65
84
  # Initializes a new permalink object and sets permalink attribute.
66
85
  def set_permalink
67
86
  begin
@@ -1,5 +1,5 @@
1
1
  module Vidibus
2
2
  module Permalink
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-permalink
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andre Pankratz
@@ -19,8 +19,6 @@ date: 2011-09-05 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: active_support
23
- prerelease: false
24
22
  requirement: &id001 !ruby/object:Gem::Requirement
25
23
  none: false
26
24
  requirements:
@@ -31,11 +29,11 @@ dependencies:
31
29
  - 3
32
30
  - 0
33
31
  version: "3.0"
34
- type: :runtime
35
32
  version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: mongoid
33
+ name: active_support
38
34
  prerelease: false
35
+ type: :runtime
36
+ - !ruby/object:Gem::Dependency
39
37
  requirement: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
@@ -45,11 +43,11 @@ dependencies:
45
43
  segments:
46
44
  - 2
47
45
  version: "2"
48
- type: :runtime
49
46
  version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: vidibus-core_extensions
47
+ name: mongoid
52
48
  prerelease: false
49
+ type: :runtime
50
+ - !ruby/object:Gem::Dependency
53
51
  requirement: &id003 !ruby/object:Gem::Requirement
54
52
  none: false
55
53
  requirements:
@@ -59,11 +57,11 @@ dependencies:
59
57
  segments:
60
58
  - 0
61
59
  version: "0"
62
- type: :runtime
63
60
  version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
65
- name: vidibus-uuid
61
+ name: vidibus-core_extensions
66
62
  prerelease: false
63
+ type: :runtime
64
+ - !ruby/object:Gem::Dependency
67
65
  requirement: &id004 !ruby/object:Gem::Requirement
68
66
  none: false
69
67
  requirements:
@@ -73,11 +71,11 @@ dependencies:
73
71
  segments:
74
72
  - 0
75
73
  version: "0"
76
- type: :runtime
77
74
  version_requirements: *id004
78
- - !ruby/object:Gem::Dependency
79
- name: vidibus-words
75
+ name: vidibus-uuid
80
76
  prerelease: false
77
+ type: :runtime
78
+ - !ruby/object:Gem::Dependency
81
79
  requirement: &id005 !ruby/object:Gem::Requirement
82
80
  none: false
83
81
  requirements:
@@ -87,11 +85,11 @@ dependencies:
87
85
  segments:
88
86
  - 0
89
87
  version: "0"
90
- type: :runtime
91
88
  version_requirements: *id005
92
- - !ruby/object:Gem::Dependency
93
- name: bundler
89
+ name: vidibus-words
94
90
  prerelease: false
91
+ type: :runtime
92
+ - !ruby/object:Gem::Dependency
95
93
  requirement: &id006 !ruby/object:Gem::Requirement
96
94
  none: false
97
95
  requirements:
@@ -103,11 +101,11 @@ dependencies:
103
101
  - 0
104
102
  - 0
105
103
  version: 1.0.0
106
- type: :development
107
104
  version_requirements: *id006
108
- - !ruby/object:Gem::Dependency
109
- name: rspec
105
+ name: bundler
110
106
  prerelease: false
107
+ type: :development
108
+ - !ruby/object:Gem::Dependency
111
109
  requirement: &id007 !ruby/object:Gem::Requirement
112
110
  none: false
113
111
  requirements:
@@ -117,11 +115,11 @@ dependencies:
117
115
  segments:
118
116
  - 2
119
117
  version: "2"
120
- type: :development
121
118
  version_requirements: *id007
122
- - !ruby/object:Gem::Dependency
123
- name: rr
119
+ name: rspec
124
120
  prerelease: false
121
+ type: :development
122
+ - !ruby/object:Gem::Dependency
125
123
  requirement: &id008 !ruby/object:Gem::Requirement
126
124
  none: false
127
125
  requirements:
@@ -131,11 +129,11 @@ dependencies:
131
129
  segments:
132
130
  - 0
133
131
  version: "0"
134
- type: :development
135
132
  version_requirements: *id008
136
- - !ruby/object:Gem::Dependency
137
- name: rake
133
+ name: rr
138
134
  prerelease: false
135
+ type: :development
136
+ - !ruby/object:Gem::Dependency
139
137
  requirement: &id009 !ruby/object:Gem::Requirement
140
138
  none: false
141
139
  requirements:
@@ -145,12 +143,26 @@ dependencies:
145
143
  segments:
146
144
  - 0
147
145
  version: "0"
148
- type: :development
149
146
  version_requirements: *id009
147
+ name: rake
148
+ prerelease: false
149
+ type: :development
150
150
  - !ruby/object:Gem::Dependency
151
+ requirement: &id010 !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ hash: 3
157
+ segments:
158
+ - 0
159
+ version: "0"
160
+ version_requirements: *id010
151
161
  name: rcov
152
162
  prerelease: false
153
- requirement: &id010 !ruby/object:Gem::Requirement
163
+ type: :development
164
+ - !ruby/object:Gem::Dependency
165
+ requirement: &id011 !ruby/object:Gem::Requirement
154
166
  none: false
155
167
  requirements:
156
168
  - - ">="
@@ -159,8 +171,10 @@ dependencies:
159
171
  segments:
160
172
  - 0
161
173
  version: "0"
174
+ version_requirements: *id011
175
+ name: rdoc
176
+ prerelease: false
162
177
  type: :development
163
- version_requirements: *id010
164
178
  description: Allows changeable permalinks (good for SEO).
165
179
  email: andre@vidibus.com
166
180
  executables: []