decent_exposure 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -28,6 +28,12 @@ In `Gemfile`:
28
28
  Examples
29
29
  --------
30
30
 
31
+ ### Railscast
32
+
33
+ Ryan Bates has a Railscasts episode covering `decent_exposure`. If you're just
34
+ getting started or just enjoy screencasts (Ryan's are always great), you can
35
+ check it out here: [Railscasts - Decent Exposure][railscast].
36
+
31
37
  ### A full example
32
38
 
33
39
  The wiki has a full example of [converting a classic-style Rails
@@ -146,6 +152,7 @@ Ryan Tomayko's [excellent treatise][treatise] on the subject).
146
152
  [treatise]: http://tomayko.com/writings/require-rubygems-antipattern
147
153
  [converting]: http://github.com/voxdolo/decent_exposure/wiki/Examples
148
154
  [diatribe]: http://blog.voxdolo.me/a-diatribe-on-maintaining-state.html
155
+ [railscast]: http://railscasts.com/episodes/259-decent-exposure
149
156
 
150
157
  Contributors
151
158
  ------------
@@ -20,10 +20,12 @@ module DecentExposure
20
20
  closured_exposure = default_exposure
21
21
  define_method name do
22
22
  @_resources ||= {}
23
- @_resources[name] ||= if block_given?
24
- instance_eval(&block)
25
- else
26
- instance_exec(name, &closured_exposure)
23
+ @_resources.fetch(name) do
24
+ @_resources[name] = if block_given?
25
+ instance_eval(&block)
26
+ else
27
+ instance_exec(name, &closured_exposure)
28
+ end
27
29
  end
28
30
  end
29
31
  helper_method name
@@ -14,6 +14,7 @@ module DecentExposure
14
14
  class Railtie
15
15
  def self.insert
16
16
  ActionController::Base.send(:include, DecentExposure::DefaultExposure)
17
+ ActionController::Base.protected_instance_variables.push("@_resources")
17
18
  end
18
19
  end
19
20
  end
@@ -1,3 +1,3 @@
1
1
  module DecentExposure #:nodoc
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,88 +1,83 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: decent_exposure
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 1
9
- version: 1.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Stephen Caudill
13
9
  - Jon Larkowski
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2011-02-27 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
13
+ date: 2012-03-08 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &70182141020280 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
19
+ requirements:
27
20
  - - ~>
28
- - !ruby/object:Gem::Version
29
- segments:
30
- - 2
31
- - 3
32
- - 0
33
- version: 2.3.0
21
+ - !ruby/object:Gem::Version
22
+ version: 2.5.0
34
23
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
24
+ prerelease: false
25
+ version_requirements: *70182141020280
26
+ - !ruby/object:Gem::Dependency
37
27
  name: mocha
28
+ requirement: &70182141019820 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.12
34
+ type: :development
38
35
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
36
+ version_requirements: *70182141019820
37
+ - !ruby/object:Gem::Dependency
38
+ name: ruby-debug19
39
+ requirement: &70182141019360 !ruby/object:Gem::Requirement
40
40
  none: false
41
- requirements:
41
+ requirements:
42
42
  - - ~>
43
- - !ruby/object:Gem::Version
44
- segments:
45
- - 0
46
- - 9
47
- - 8
48
- version: 0.9.8
43
+ - !ruby/object:Gem::Version
44
+ version: 0.11.6
49
45
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: actionpack
53
46
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
47
+ version_requirements: *70182141019360
48
+ - !ruby/object:Gem::Dependency
49
+ name: actionpack
50
+ requirement: &70182141018980 !ruby/object:Gem::Requirement
55
51
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- segments:
60
- - 0
61
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
62
56
  type: :development
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
65
- name: activesupport
66
57
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
58
+ version_requirements: *70182141018980
59
+ - !ruby/object:Gem::Dependency
60
+ name: activesupport
61
+ requirement: &70182141018520 !ruby/object:Gem::Requirement
68
62
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- segments:
73
- - 0
74
- version: "0"
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
75
67
  type: :development
76
- version_requirements: *id004
77
- description: "\n DecentExposure helps you program to an interface, rather than an\n implementation in your Rails controllers. The fact of the matter is that\n sharing state via instance variables in controllers promotes close coupling\n with views. DecentExposure gives you a declarative manner of exposing an\n interface to the state that controllers contain and thereby decreasing\n coupling and improving your testability and overall design.\n "
68
+ prerelease: false
69
+ version_requirements: *70182141018520
70
+ description: ! "\n DecentExposure helps you program to an interface, rather than
71
+ an\n implementation in your Rails controllers. The fact of the matter is that\n
72
+ \ sharing state via instance variables in controllers promotes close coupling\n
73
+ \ with views. DecentExposure gives you a declarative manner of exposing an\n
74
+ \ interface to the state that controllers contain and thereby decreasing\n coupling
75
+ and improving your testability and overall design.\n "
78
76
  email: scaudill@gmail.com
79
77
  executables: []
80
-
81
78
  extensions: []
82
-
83
79
  extra_rdoc_files: []
84
-
85
- files:
80
+ files:
86
81
  - lib/decent_exposure/default_exposure.rb
87
82
  - lib/decent_exposure/railtie.rb
88
83
  - lib/decent_exposure/version.rb
@@ -91,39 +86,29 @@ files:
91
86
  - COPYING
92
87
  - init.rb
93
88
  - rails/init.rb
94
- has_rdoc: true
95
89
  homepage: http://github.com/voxdolo/decent_exposure
96
90
  licenses: []
97
-
98
91
  post_install_message:
99
- rdoc_options:
92
+ rdoc_options:
100
93
  - --charset=UTF-8
101
- require_paths:
94
+ require_paths:
102
95
  - lib
103
- required_ruby_version: !ruby/object:Gem::Requirement
96
+ required_ruby_version: !ruby/object:Gem::Requirement
104
97
  none: false
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- segments:
109
- - 0
110
- version: "0"
111
- required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
103
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- segments:
117
- - 1
118
- - 3
119
- - 6
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
120
107
  version: 1.3.6
121
108
  requirements: []
122
-
123
109
  rubyforge_project:
124
- rubygems_version: 1.3.7
110
+ rubygems_version: 1.8.6
125
111
  signing_key:
126
112
  specification_version: 3
127
113
  summary: A helper for creating declarative interfaces in controllers
128
114
  test_files: []
129
-