defer_draper 0.0.1 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cf75e688452eb2bfbbdaf566ba3d30f4d4cef00
4
- data.tar.gz: 7edcb7b28a417fa436d4496f5229f1f451d25913
3
+ metadata.gz: 5154a43854631dc5cc3084d80b3a9f025ef1cfd9
4
+ data.tar.gz: 23f5b8e2b40b15684b0ec7c27ad5abf517c89198
5
5
  SHA512:
6
- metadata.gz: 862911e5995d06086d0b9326a75ba8174b81911221ad9419befae9f01994fc823cb991619d28f7247bccce591a5b1122f10736321d0b471b071dda5ad4143f5c
7
- data.tar.gz: 96fb250b4f296cab30656d8804211f4063a25229be45733132088f1decf02281574171aba85ff694f7f8ef6285474174bdd738389801a9ea3385f085ad43ecc5
6
+ metadata.gz: d0b030a77389274ccb8dcdb9799d7d9bbcc40ffc796599369bf860f4e92ac8a0eb3a92b6c1068515a8195257b7cb24d27d9407ba8f56cf665fdc46b095866ca1
7
+ data.tar.gz: c5409145ff996f40e4e47fa81ac2c60fad43587bf741b0d27c23060639236913fafbb96cdd30435b0fb1d51079db82d966f0616045d2abfdb7180aa31d6c1529
@@ -0,0 +1,27 @@
1
+ module ActionController
2
+ class Base
3
+ def render(options = nil, extra_options = {}, &block)
4
+ if self.defer_draper_decorate
5
+ self.instance_variables.select {|variable|
6
+ not variable.to_s.start_with?('@_')
7
+ }.map {|variable_name|
8
+ [variable_name, self.instance_variable_get(variable_name)]
9
+ }.select {|variable_name, variable|
10
+ variable.respond_to?(:decorate)
11
+ }.each {|variable_name, variable|
12
+ begin
13
+ self.instance_variable_set(variable_name, variable.decorate)
14
+ rescue Draper::UninferrableDecoratorError
15
+ ;
16
+ end
17
+ }
18
+ end
19
+
20
+ super(options, extra_options, &block)
21
+ end
22
+
23
+ def defer_draper_decorate
24
+ return false
25
+ end
26
+ end
27
+ end
data/lib/defer_draper.rb CHANGED
@@ -1,21 +1,11 @@
1
- module ActionController
2
- class Base
3
- def render(options = nil, extra_options = {}, &block)
4
- self.instance_variables.select {|variable|
5
- not variable.to_s.start_with?('@_')
6
- }.map {|variable_name|
7
- [variable_name, self.instance_variable_get(variable_name)]
8
- }.select {|variable_name, variable|
9
- variable.respond_to?(:decorate)
10
- }.each {|variable_name, variable|
11
- begin
12
- self.instance_variable_set(variable_name, variable.decorate)
13
- rescue Draper::UninferrableDecoratorError
14
- ;
15
- end
16
- }
1
+ require 'defer_draper/action_controller'
17
2
 
18
- super(options, extra_options, &block)
3
+ module DeferDraper
4
+ def decorate_all
5
+ def self.defer_draper_decorate
6
+ return true
19
7
  end
20
8
  end
21
9
  end
10
+
11
+ ActionController::Base.send :include, DeferDraper
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defer_draper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Franco
@@ -52,14 +52,15 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.12'
55
- description: Decorate your variables just before render
55
+ description: Decorate all your instance variables just before render
56
56
  email: ricardo.krieg@gmail.com
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
61
  - lib/defer_draper.rb
62
- homepage: http://github.com/ricardokrieg/defer_draper
62
+ - lib/defer_draper/action_controller.rb
63
+ homepage: https://github.com/ricardokrieg/defer_draper
63
64
  licenses: []
64
65
  metadata: {}
65
66
  post_install_message:
@@ -81,5 +82,5 @@ rubyforge_project:
81
82
  rubygems_version: 2.0.0.rc.2
82
83
  signing_key:
83
84
  specification_version: 4
84
- summary: Defer Draper
85
+ summary: Decorate your variables
85
86
  test_files: []