kelredd-sinatra-helpers 0.2.3 → 0.2.4
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.
@@ -57,7 +57,8 @@ module SinatraHelpers::Erb::Partials
|
|
57
57
|
def partial(path, locals={}, &subject_block)
|
58
58
|
raise "locals must be specified with a Hash" unless locals.kind_of?(::Hash)
|
59
59
|
params = _partial_params(path, locals, subject_block)
|
60
|
-
|
60
|
+
# locals[:object] takes precedence over whatever calculated subject
|
61
|
+
if locals.delete(:object).nil? && params[:subject] && params[:subject].respond_to?(:collect)
|
61
62
|
counter = 0
|
62
63
|
params[:subject].collect do |subject|
|
63
64
|
erb(params[:path], params[:options].merge({
|
@@ -87,7 +88,7 @@ module SinatraHelpers::Erb::Partials
|
|
87
88
|
nil
|
88
89
|
end ||
|
89
90
|
locals.delete(:collection) ||
|
90
|
-
locals
|
91
|
+
locals[:object] || # don't remove it from the locals hash just yet
|
91
92
|
locals.delete(name),
|
92
93
|
:locals => locals.delete(:locals) || locals,
|
93
94
|
:options => { :layout => false },
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kelly Redding
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-08 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|