decorators 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/decorators.rb +13 -3
- data/readme.md +10 -1
- metadata +11 -12
data/lib/decorators.rb
CHANGED
@@ -14,9 +14,7 @@ module Decorators
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def decorators
|
17
|
-
paths.registered.map { |path|
|
18
|
-
Dir[path.join('app', 'decorators', '**', '*_decorator.rb')]
|
19
|
-
}.flatten.uniq
|
17
|
+
paths.registered.map { |path| find_decorators_in_path(path) }.flatten.uniq
|
20
18
|
end
|
21
19
|
|
22
20
|
def register!(*paths_to_register)
|
@@ -29,6 +27,18 @@ module Decorators
|
|
29
27
|
def paths
|
30
28
|
@paths ||= Paths.new
|
31
29
|
end
|
30
|
+
|
31
|
+
def apply_decorators_pattern_to_path(path)
|
32
|
+
path.join *pattern
|
33
|
+
end
|
34
|
+
|
35
|
+
def find_decorators_in_path(path)
|
36
|
+
Dir[apply_decorators_pattern_to_path(path)]
|
37
|
+
end
|
38
|
+
|
39
|
+
def pattern
|
40
|
+
['app', 'decorators', '*', '**', '*_decorator.rb']
|
41
|
+
end
|
32
42
|
end
|
33
43
|
|
34
44
|
end
|
data/readme.md
CHANGED
@@ -7,7 +7,16 @@ initialisation process.
|
|
7
7
|
|
8
8
|
Decorators must follow this naming convention:
|
9
9
|
|
10
|
-
app/decorators/<
|
10
|
+
app/decorators/<at least one subdirectory>/something_decorator.rb
|
11
|
+
|
12
|
+
This is an example of a decorator that will be loaded:
|
13
|
+
|
14
|
+
app/decorators/controllers/pages_controller_decorator.rb
|
15
|
+
|
16
|
+
These are examples of decorators that *won't* be loaded:
|
17
|
+
|
18
|
+
app/decorators/pages_controller_decorator.rb
|
19
|
+
app/decorators/controllers/pages_controller.rb
|
11
20
|
|
12
21
|
The important parts are being inside a sub directory of `app/decorators` and having
|
13
22
|
`_decorator.rb` at the end of the file's name.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decorators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
prerelease: false
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
@@ -82,9 +82,10 @@ dependencies:
|
|
82
82
|
- - ! '!='
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 3.2.10
|
85
|
-
none: false
|
86
85
|
type: :runtime
|
86
|
+
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
88
89
|
requirements:
|
89
90
|
- - ! '>='
|
90
91
|
- !ruby/object:Gem::Version
|
@@ -152,23 +153,22 @@ dependencies:
|
|
152
153
|
- - ! '!='
|
153
154
|
- !ruby/object:Gem::Version
|
154
155
|
version: 3.2.10
|
155
|
-
none: false
|
156
156
|
- !ruby/object:Gem::Dependency
|
157
157
|
name: rspec
|
158
|
-
prerelease: false
|
159
158
|
requirement: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
160
|
requirements:
|
161
161
|
- - ! '>='
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: '0'
|
164
|
-
none: false
|
165
164
|
type: :development
|
165
|
+
prerelease: false
|
166
166
|
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
167
168
|
requirements:
|
168
169
|
- - ! '>='
|
169
170
|
- !ruby/object:Gem::Version
|
170
171
|
version: '0'
|
171
|
-
none: false
|
172
172
|
description: Manages the process of loading decorators into your Rails application.
|
173
173
|
email: parndt@gmail.com
|
174
174
|
executables: []
|
@@ -188,22 +188,21 @@ rdoc_options: []
|
|
188
188
|
require_paths:
|
189
189
|
- lib
|
190
190
|
required_ruby_version: !ruby/object:Gem::Requirement
|
191
|
+
none: false
|
191
192
|
requirements:
|
192
193
|
- - ! '>='
|
193
194
|
- !ruby/object:Gem::Version
|
194
195
|
version: '0'
|
195
|
-
none: false
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
|
+
none: false
|
197
198
|
requirements:
|
198
199
|
- - ! '>='
|
199
200
|
- !ruby/object:Gem::Version
|
200
201
|
version: '0'
|
201
|
-
none: false
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 1.8.
|
204
|
+
rubygems_version: 1.8.25
|
205
205
|
signing_key:
|
206
206
|
specification_version: 3
|
207
207
|
summary: Rails decorators plugin.
|
208
208
|
test_files: []
|
209
|
-
has_rdoc:
|