draper 0.12.0 → 0.13.0
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/.travis.yml +3 -5
- data/CHANGELOG.txt +19 -2
- data/Gemfile +0 -14
- data/Readme.markdown +8 -16
- data/draper.gemspec +12 -2
- data/lib/draper/active_model_support.rb +13 -5
- data/lib/draper/base.rb +3 -3
- data/lib/draper/version.rb +1 -1
- data/lib/draper.rb +3 -1
- data/lib/generators/decorator/decorator_generator.rb +1 -1
- data/lib/generators/decorator/templates/decorator.rb +1 -1
- data/spec/draper/base_spec.rb +19 -6
- data/spec/generators/decorator/decorator_generator_spec.rb +22 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/support/samples/decorator_with_allows.rb +0 -0
- data/spec/support/samples/decorator_with_special_methods.rb +13 -0
- metadata +182 -36
data/.travis.yml
CHANGED
data/CHANGELOG.txt
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
= Draper Changelog
|
|
2
2
|
|
|
3
|
-
=
|
|
3
|
+
= 0.13.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
* Upgraded all dependencies
|
|
6
|
+
|
|
7
|
+
* Dropped support for Rubies < 1.9.3
|
|
8
|
+
|
|
9
|
+
* #to_model has been renamed to #wrapped_object
|
|
10
|
+
|
|
11
|
+
* Allow proper overriding of special ActiveModel methods
|
|
12
|
+
|
|
13
|
+
== 0.12.2
|
|
14
|
+
|
|
15
|
+
* Fix bug with initializing ammeter
|
|
16
|
+
|
|
17
|
+
* Some gems are now development only in the gemspec
|
|
18
|
+
|
|
19
|
+
* Fix bug where generated models were still inheriting from
|
|
20
|
+
ApplicationDecorator
|
|
21
|
+
|
|
22
|
+
== 0.12.0
|
|
6
23
|
|
|
7
24
|
* Added Changelog
|
|
8
25
|
|
data/Gemfile
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
1
|
source :rubygems
|
|
2
2
|
|
|
3
|
-
gem 'rake'
|
|
4
|
-
gem 'rspec', '~> 2.0'
|
|
5
|
-
gem 'activesupport', '~> 3.1.3'
|
|
6
|
-
gem 'actionpack', "~> 3.1.3", :require => 'action_view'
|
|
7
|
-
gem 'ammeter', '~> 0.2.2', :require => 'ammeter/init'
|
|
8
|
-
gem 'guard'
|
|
9
|
-
gem 'guard-rspec'
|
|
10
|
-
gem 'launchy'
|
|
11
|
-
gem 'yard'
|
|
12
|
-
|
|
13
|
-
group :development do
|
|
14
|
-
gem 'redcarpet'
|
|
15
|
-
end
|
|
16
|
-
|
|
17
3
|
gemspec
|
data/Readme.markdown
CHANGED
|
@@ -155,20 +155,12 @@ gem "draper"
|
|
|
155
155
|
|
|
156
156
|
Then run `bundle` from the project directory.
|
|
157
157
|
|
|
158
|
-
### Run the draper:install command
|
|
159
|
-
|
|
160
|
-
This will create the `app/decorators` directory and the `ApplicationDecorator` inside it.
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
rails generate draper:install
|
|
164
|
-
```
|
|
165
|
-
|
|
166
158
|
### Generate the Decorator
|
|
167
159
|
|
|
168
160
|
To decorate a model named `Article`:
|
|
169
161
|
|
|
170
162
|
```
|
|
171
|
-
rails generate
|
|
163
|
+
rails generate decorator article
|
|
172
164
|
```
|
|
173
165
|
|
|
174
166
|
### Writing Methods
|
|
@@ -176,7 +168,7 @@ rails generate draper:decorator article
|
|
|
176
168
|
Open the decorator model (ex: `app/decorators/article_decorator.rb`) and add normal instance methods. To access the wrapped source object, use a method named after the `decorates` argument:
|
|
177
169
|
|
|
178
170
|
```ruby
|
|
179
|
-
class ArticleDecorator <
|
|
171
|
+
class ArticleDecorator < Draper::Base
|
|
180
172
|
decorates :article
|
|
181
173
|
|
|
182
174
|
def author_name
|
|
@@ -190,7 +182,7 @@ end
|
|
|
190
182
|
You probably want to make use of Rails helpers and those defined in your application. Use the `helpers` or `h` method proxy:
|
|
191
183
|
|
|
192
184
|
```ruby
|
|
193
|
-
class ArticleDecorator <
|
|
185
|
+
class ArticleDecorator < Draper::Base
|
|
194
186
|
decorates :article
|
|
195
187
|
|
|
196
188
|
def published_at
|
|
@@ -206,7 +198,7 @@ end
|
|
|
206
198
|
Hate seeing that `h.` proxy all over? Willing to mix a bazillion methods into your decorator? Then try lazy helpers:
|
|
207
199
|
|
|
208
200
|
```ruby
|
|
209
|
-
class ArticleDecorator <
|
|
201
|
+
class ArticleDecorator < Draper::Base
|
|
210
202
|
decorates :article
|
|
211
203
|
include Draper::LazyHelpers
|
|
212
204
|
|
|
@@ -313,7 +305,7 @@ end
|
|
|
313
305
|
Then you need to perform the wrapping in your controller. Here's the simplest method:
|
|
314
306
|
|
|
315
307
|
```ruby
|
|
316
|
-
class ArticlesController <
|
|
308
|
+
class ArticlesController < Draper::Decorator
|
|
317
309
|
def show
|
|
318
310
|
@article = ArticleDecorator.find params[:id]
|
|
319
311
|
end
|
|
@@ -329,7 +321,7 @@ Then within your views you can utilize both the normal data methods and your new
|
|
|
329
321
|
Ta-da! Object-oriented data formatting for your view layer. Below is the complete decorator with extra comments removed:
|
|
330
322
|
|
|
331
323
|
```ruby
|
|
332
|
-
class ArticleDecorator <
|
|
324
|
+
class ArticleDecorator < Draper::Base
|
|
333
325
|
decorates :article
|
|
334
326
|
|
|
335
327
|
def published_at
|
|
@@ -345,12 +337,12 @@ end
|
|
|
345
337
|
Add a `decorates_association :association_name` to gain access to a decorated version of your target association.
|
|
346
338
|
|
|
347
339
|
```ruby
|
|
348
|
-
class ArticleDecorator <
|
|
340
|
+
class ArticleDecorator < Draper::Base
|
|
349
341
|
decorates :article
|
|
350
342
|
decorates_association :author # belongs_to :author association
|
|
351
343
|
end
|
|
352
344
|
|
|
353
|
-
class AuthorDecorator <
|
|
345
|
+
class AuthorDecorator < Draper::Base
|
|
354
346
|
decorates :author
|
|
355
347
|
|
|
356
348
|
def fancy_name
|
data/draper.gemspec
CHANGED
|
@@ -15,6 +15,16 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
17
17
|
s.require_paths = ["lib"]
|
|
18
|
-
|
|
19
|
-
s.
|
|
18
|
+
|
|
19
|
+
s.add_dependency 'activesupport', '~> 3.2'
|
|
20
|
+
s.add_dependency 'rake', '~> 0.9.2'
|
|
21
|
+
s.add_dependency 'rspec', '~> 2.10'
|
|
22
|
+
s.add_dependency 'activesupport', '~> 3.2'
|
|
23
|
+
s.add_dependency 'actionpack', '~> 3.2'
|
|
24
|
+
|
|
25
|
+
s.add_development_dependency 'ammeter', '~> 0.2.2'
|
|
26
|
+
s.add_development_dependency 'guard'
|
|
27
|
+
s.add_development_dependency 'guard-rspec'
|
|
28
|
+
s.add_development_dependency 'launchy'
|
|
29
|
+
s.add_development_dependency 'yard'
|
|
20
30
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Draper::ActiveModelSupport
|
|
2
2
|
module Proxies
|
|
3
|
-
def
|
|
3
|
+
def self.extended(base)
|
|
4
4
|
# These methods (as keys) will be created only if the correspondent
|
|
5
5
|
# model descends from a specific class (as value)
|
|
6
6
|
proxies = {}
|
|
@@ -9,16 +9,24 @@ module Draper::ActiveModelSupport
|
|
|
9
9
|
proxies[:id] = ActiveRecord::Base if defined?(ActiveRecord::Base)
|
|
10
10
|
|
|
11
11
|
proxies.each do |method_name, dependency|
|
|
12
|
-
if model.kind_of?(dependency) || dependency.nil?
|
|
13
|
-
class <<
|
|
12
|
+
if base.model.kind_of?(dependency) || dependency.nil?
|
|
13
|
+
class << base
|
|
14
14
|
self
|
|
15
15
|
end.class_eval do
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
if !base.class.instance_methods.include?(method_name) || base.class.instance_method(method_name).owner === Draper::Base
|
|
17
|
+
send(:define_method, method_name) do |*args, &block|
|
|
18
|
+
model.send(method_name, *args, &block)
|
|
19
|
+
end
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
end
|
|
24
|
+
|
|
25
|
+
base.class_eval do
|
|
26
|
+
def to_model
|
|
27
|
+
self
|
|
28
|
+
end
|
|
29
|
+
end
|
|
22
30
|
end
|
|
23
31
|
end
|
|
24
32
|
end
|
data/lib/draper/base.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Draper
|
|
|
11
11
|
self.denied = DEFAULT_DENIED
|
|
12
12
|
self.allowed = DEFAULT_ALLOWED
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
|
|
16
16
|
# Initialize a new decorator instance by passing in
|
|
17
17
|
# an instance of the source class. Pass in an optional
|
|
@@ -24,7 +24,7 @@ module Draper
|
|
|
24
24
|
self.class.model_class = input.class if model_class.nil?
|
|
25
25
|
@model = input.kind_of?(Draper::Base) ? input.model : input
|
|
26
26
|
self.options = options
|
|
27
|
-
|
|
27
|
+
self.extend Draper::ActiveModelSupport::Proxies
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Proxies to the class specified by `decorates` to automatically
|
|
@@ -191,7 +191,7 @@ module Draper
|
|
|
191
191
|
# Fetch the original wrapped model.
|
|
192
192
|
#
|
|
193
193
|
# @return [Object] original_model
|
|
194
|
-
def
|
|
194
|
+
def wrapped_object
|
|
195
195
|
@model
|
|
196
196
|
end
|
|
197
197
|
|
data/lib/draper/version.rb
CHANGED
data/lib/draper.rb
CHANGED
data/spec/draper/base_spec.rb
CHANGED
|
@@ -182,10 +182,9 @@ describe Draper::Base do
|
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
|
|
185
|
-
context(".
|
|
185
|
+
context(".wrapped_object") do
|
|
186
186
|
it "should return the wrapped object" do
|
|
187
|
-
subject.
|
|
188
|
-
subject.model.should == source
|
|
187
|
+
subject.wrapped_object.should == source
|
|
189
188
|
end
|
|
190
189
|
end
|
|
191
190
|
|
|
@@ -216,19 +215,33 @@ describe Draper::Base do
|
|
|
216
215
|
end
|
|
217
216
|
|
|
218
217
|
context "when an ActiveModel descendant" do
|
|
219
|
-
it "should always proxy to_param" do
|
|
218
|
+
it "should always proxy to_param if it is not defined on the decorator itself" do
|
|
220
219
|
source.stub(:to_param).and_return(1)
|
|
221
220
|
Draper::Base.new(source).to_param.should == 1
|
|
222
221
|
end
|
|
223
222
|
|
|
224
|
-
it "should always proxy id" do
|
|
223
|
+
it "should always proxy id if it is not defined on the decorator itself" do
|
|
225
224
|
source.stub(:id).and_return(123456789)
|
|
226
225
|
Draper::Base.new(source).id.should == 123456789
|
|
227
226
|
end
|
|
228
227
|
|
|
229
|
-
it "should always proxy errors" do
|
|
228
|
+
it "should always proxy errors if it is not defined on the decorator itself" do
|
|
230
229
|
Draper::Base.new(source).errors.should be_an_instance_of ActiveModel::Errors
|
|
231
230
|
end
|
|
231
|
+
|
|
232
|
+
it "should never proxy to_param if it is defined on the decorator itself" do
|
|
233
|
+
source.stub(:to_param).and_return(1)
|
|
234
|
+
DecoratorWithSpecialMethods.new(source).to_param.should == "foo"
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
it "should never proxy id if it is defined on the decorator itself" do
|
|
238
|
+
source.stub(:id).and_return(123456789)
|
|
239
|
+
DecoratorWithSpecialMethods.new(source).id.should == 1337
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it "should never proxy errors if it is defined on the decorator itself" do
|
|
243
|
+
DecoratorWithSpecialMethods.new(source).errors.should be_an_instance_of Array
|
|
244
|
+
end
|
|
232
245
|
end
|
|
233
246
|
|
|
234
247
|
context "when not an ActiveModel descendant" do
|
|
@@ -15,7 +15,7 @@ describe Rails::Generators::DecoratorGenerator do
|
|
|
15
15
|
describe 'app/decorators/your_model_decorator.rb' do
|
|
16
16
|
subject { file('app/decorators/your_model_decorator.rb') }
|
|
17
17
|
it { should exist }
|
|
18
|
-
it { should contain "class YourModelDecorator <
|
|
18
|
+
it { should contain "class YourModelDecorator < Draper::Base" }
|
|
19
19
|
it { should contain "decorates :your_model" }
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -30,6 +30,27 @@ describe Rails::Generators::DecoratorGenerator do
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
context 'parent decorator' do
|
|
34
|
+
describe 'decorator inhereted from Draper::Base' do
|
|
35
|
+
before { run_generator ["YourModel"] }
|
|
36
|
+
|
|
37
|
+
subject { file('app/decorators/your_model_decorator.rb') }
|
|
38
|
+
it { should exist }
|
|
39
|
+
it { should contain "class YourModelDecorator < Draper::Base" }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe "decorator inhereted from ApplicationDecorator if it's present" do
|
|
43
|
+
before do
|
|
44
|
+
class ApplicationDecorator; end
|
|
45
|
+
run_generator ["YourModel"]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
subject { file('app/decorators/your_model_decorator.rb') }
|
|
49
|
+
it { should exist }
|
|
50
|
+
it { should contain "class YourModelDecorator < ApplicationDecorator" }
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
33
54
|
context 'using rspec' do
|
|
34
55
|
before { run_generator ["YourModel", "-t=rspec"] }
|
|
35
56
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
|
3
|
+
require 'ammeter/init'
|
|
3
4
|
require 'rails'
|
|
4
5
|
|
|
5
6
|
Bundler.require
|
|
@@ -13,6 +14,7 @@ require './spec/support/samples/decorator_with_allows'
|
|
|
13
14
|
require './spec/support/samples/decorator_with_multiple_allows'
|
|
14
15
|
require './spec/support/samples/decorator_with_application_helper'
|
|
15
16
|
require './spec/support/samples/decorator_with_denies'
|
|
17
|
+
require './spec/support/samples/decorator_with_special_methods'
|
|
16
18
|
require './spec/support/samples/namespaced_product'
|
|
17
19
|
require './spec/support/samples/namespaced_product_decorator'
|
|
18
20
|
require './spec/support/samples/non_active_model_product'
|
|
File without changes
|
metadata
CHANGED
|
@@ -1,47 +1,182 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: draper
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 43
|
|
5
5
|
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 13
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.13.0
|
|
6
11
|
platform: ruby
|
|
7
|
-
authors:
|
|
12
|
+
authors:
|
|
8
13
|
- Jeff Casimir
|
|
9
14
|
- Steve Klabnik
|
|
10
15
|
autorequire:
|
|
11
16
|
bindir: bin
|
|
12
17
|
cert_chain: []
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
date: 2012-05-12 00:00:00 Z
|
|
20
|
+
dependencies:
|
|
21
|
+
- !ruby/object:Gem::Dependency
|
|
16
22
|
name: activesupport
|
|
17
|
-
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 3
|
|
30
|
+
segments:
|
|
31
|
+
- 3
|
|
32
|
+
- 2
|
|
33
|
+
version: "3.2"
|
|
34
|
+
type: :runtime
|
|
35
|
+
version_requirements: *id001
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: rake
|
|
38
|
+
prerelease: false
|
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
18
40
|
none: false
|
|
19
|
-
requirements:
|
|
20
|
-
- -
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
|
|
41
|
+
requirements:
|
|
42
|
+
- - ~>
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 63
|
|
45
|
+
segments:
|
|
46
|
+
- 0
|
|
47
|
+
- 9
|
|
48
|
+
- 2
|
|
49
|
+
version: 0.9.2
|
|
23
50
|
type: :runtime
|
|
51
|
+
version_requirements: *id002
|
|
52
|
+
- !ruby/object:Gem::Dependency
|
|
53
|
+
name: rspec
|
|
24
54
|
prerelease: false
|
|
25
|
-
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: redcarpet
|
|
28
|
-
requirement: &70309298924340 !ruby/object:Gem::Requirement
|
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
29
56
|
none: false
|
|
30
|
-
requirements:
|
|
31
|
-
- -
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
|
|
57
|
+
requirements:
|
|
58
|
+
- - ~>
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
hash: 23
|
|
61
|
+
segments:
|
|
62
|
+
- 2
|
|
63
|
+
- 10
|
|
64
|
+
version: "2.10"
|
|
65
|
+
type: :runtime
|
|
66
|
+
version_requirements: *id003
|
|
67
|
+
- !ruby/object:Gem::Dependency
|
|
68
|
+
name: activesupport
|
|
69
|
+
prerelease: false
|
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
71
|
+
none: false
|
|
72
|
+
requirements:
|
|
73
|
+
- - ~>
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
hash: 3
|
|
76
|
+
segments:
|
|
77
|
+
- 3
|
|
78
|
+
- 2
|
|
79
|
+
version: "3.2"
|
|
80
|
+
type: :runtime
|
|
81
|
+
version_requirements: *id004
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: actionpack
|
|
84
|
+
prerelease: false
|
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
|
86
|
+
none: false
|
|
87
|
+
requirements:
|
|
88
|
+
- - ~>
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
hash: 3
|
|
91
|
+
segments:
|
|
92
|
+
- 3
|
|
93
|
+
- 2
|
|
94
|
+
version: "3.2"
|
|
95
|
+
type: :runtime
|
|
96
|
+
version_requirements: *id005
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: ammeter
|
|
99
|
+
prerelease: false
|
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
|
101
|
+
none: false
|
|
102
|
+
requirements:
|
|
103
|
+
- - ~>
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
hash: 19
|
|
106
|
+
segments:
|
|
107
|
+
- 0
|
|
108
|
+
- 2
|
|
109
|
+
- 2
|
|
110
|
+
version: 0.2.2
|
|
111
|
+
type: :development
|
|
112
|
+
version_requirements: *id006
|
|
113
|
+
- !ruby/object:Gem::Dependency
|
|
114
|
+
name: guard
|
|
115
|
+
prerelease: false
|
|
116
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
|
117
|
+
none: false
|
|
118
|
+
requirements:
|
|
119
|
+
- - ">="
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
hash: 3
|
|
122
|
+
segments:
|
|
123
|
+
- 0
|
|
124
|
+
version: "0"
|
|
125
|
+
type: :development
|
|
126
|
+
version_requirements: *id007
|
|
127
|
+
- !ruby/object:Gem::Dependency
|
|
128
|
+
name: guard-rspec
|
|
129
|
+
prerelease: false
|
|
130
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
|
131
|
+
none: false
|
|
132
|
+
requirements:
|
|
133
|
+
- - ">="
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
hash: 3
|
|
136
|
+
segments:
|
|
137
|
+
- 0
|
|
138
|
+
version: "0"
|
|
139
|
+
type: :development
|
|
140
|
+
version_requirements: *id008
|
|
141
|
+
- !ruby/object:Gem::Dependency
|
|
142
|
+
name: launchy
|
|
143
|
+
prerelease: false
|
|
144
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
|
145
|
+
none: false
|
|
146
|
+
requirements:
|
|
147
|
+
- - ">="
|
|
148
|
+
- !ruby/object:Gem::Version
|
|
149
|
+
hash: 3
|
|
150
|
+
segments:
|
|
151
|
+
- 0
|
|
152
|
+
version: "0"
|
|
34
153
|
type: :development
|
|
154
|
+
version_requirements: *id009
|
|
155
|
+
- !ruby/object:Gem::Dependency
|
|
156
|
+
name: yard
|
|
35
157
|
prerelease: false
|
|
36
|
-
|
|
158
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
|
159
|
+
none: false
|
|
160
|
+
requirements:
|
|
161
|
+
- - ">="
|
|
162
|
+
- !ruby/object:Gem::Version
|
|
163
|
+
hash: 3
|
|
164
|
+
segments:
|
|
165
|
+
- 0
|
|
166
|
+
version: "0"
|
|
167
|
+
type: :development
|
|
168
|
+
version_requirements: *id010
|
|
37
169
|
description: Draper implements a decorator or presenter pattern for Rails applications.
|
|
38
|
-
email:
|
|
170
|
+
email:
|
|
39
171
|
- jeff@casimircreative.com
|
|
40
172
|
- steve@steveklabnik.com
|
|
41
173
|
executables: []
|
|
174
|
+
|
|
42
175
|
extensions: []
|
|
176
|
+
|
|
43
177
|
extra_rdoc_files: []
|
|
44
|
-
|
|
178
|
+
|
|
179
|
+
files:
|
|
45
180
|
- .gitignore
|
|
46
181
|
- .rspec
|
|
47
182
|
- .travis.yml
|
|
@@ -111,6 +246,7 @@ files:
|
|
|
111
246
|
- spec/support/samples/decorator_with_application_helper.rb
|
|
112
247
|
- spec/support/samples/decorator_with_denies.rb
|
|
113
248
|
- spec/support/samples/decorator_with_multiple_allows.rb
|
|
249
|
+
- spec/support/samples/decorator_with_special_methods.rb
|
|
114
250
|
- spec/support/samples/namespaced_product.rb
|
|
115
251
|
- spec/support/samples/namespaced_product_decorator.rb
|
|
116
252
|
- spec/support/samples/non_active_model_product.rb
|
|
@@ -123,29 +259,38 @@ files:
|
|
|
123
259
|
- spec/support/samples/widget_decorator.rb
|
|
124
260
|
homepage: http://github.com/jcasimir/draper
|
|
125
261
|
licenses: []
|
|
262
|
+
|
|
126
263
|
post_install_message:
|
|
127
264
|
rdoc_options: []
|
|
128
|
-
|
|
265
|
+
|
|
266
|
+
require_paths:
|
|
129
267
|
- lib
|
|
130
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
268
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
269
|
none: false
|
|
132
|
-
requirements:
|
|
133
|
-
- -
|
|
134
|
-
- !ruby/object:Gem::Version
|
|
135
|
-
|
|
136
|
-
|
|
270
|
+
requirements:
|
|
271
|
+
- - ">="
|
|
272
|
+
- !ruby/object:Gem::Version
|
|
273
|
+
hash: 3
|
|
274
|
+
segments:
|
|
275
|
+
- 0
|
|
276
|
+
version: "0"
|
|
277
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
278
|
none: false
|
|
138
|
-
requirements:
|
|
139
|
-
- -
|
|
140
|
-
- !ruby/object:Gem::Version
|
|
141
|
-
|
|
279
|
+
requirements:
|
|
280
|
+
- - ">="
|
|
281
|
+
- !ruby/object:Gem::Version
|
|
282
|
+
hash: 3
|
|
283
|
+
segments:
|
|
284
|
+
- 0
|
|
285
|
+
version: "0"
|
|
142
286
|
requirements: []
|
|
287
|
+
|
|
143
288
|
rubyforge_project: draper
|
|
144
|
-
rubygems_version: 1.8.
|
|
289
|
+
rubygems_version: 1.8.24
|
|
145
290
|
signing_key:
|
|
146
291
|
specification_version: 3
|
|
147
292
|
summary: Decorator pattern implementation for Rails.
|
|
148
|
-
test_files:
|
|
293
|
+
test_files:
|
|
149
294
|
- spec/draper/base_spec.rb
|
|
150
295
|
- spec/draper/helper_support_spec.rb
|
|
151
296
|
- spec/draper/model_support_spec.rb
|
|
@@ -161,6 +306,7 @@ test_files:
|
|
|
161
306
|
- spec/support/samples/decorator_with_application_helper.rb
|
|
162
307
|
- spec/support/samples/decorator_with_denies.rb
|
|
163
308
|
- spec/support/samples/decorator_with_multiple_allows.rb
|
|
309
|
+
- spec/support/samples/decorator_with_special_methods.rb
|
|
164
310
|
- spec/support/samples/namespaced_product.rb
|
|
165
311
|
- spec/support/samples/namespaced_product_decorator.rb
|
|
166
312
|
- spec/support/samples/non_active_model_product.rb
|