kelredd-sinatra-helpers 0.1.2 → 0.1.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.
- data/Rakefile +1 -1
- data/lib/sinatra_helpers/erb/partials.rb +4 -3
- data/lib/sinatra_helpers/version.rb +1 -1
- metadata +3 -3
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.files = %w(README.rdoc Rakefile) + Dir.glob("{bin,lib}/**/*")
|
18
18
|
s.executables = ['sinatra']
|
19
19
|
|
20
|
-
s.add_dependency('kelredd-useful', '>= 0.2.
|
20
|
+
s.add_dependency('kelredd-useful', '>= 0.2.3')
|
21
21
|
end
|
22
22
|
|
23
23
|
Rake::GemPackageTask.new(spec) do |pkg|
|
@@ -22,12 +22,13 @@ module SinatraHelpers::Erb::Partials
|
|
22
22
|
raise 'partial collection specified but is nil' if options.has_key?(:collection) && options[:collection].nil?
|
23
23
|
if collection = options.delete(:collection)
|
24
24
|
options.delete(:object) # ignore any object passed in when using :collection
|
25
|
+
options[:locals] ||= {}
|
25
26
|
counter = 0
|
26
27
|
collection.inject([]) do |buffer, member|
|
27
28
|
counter += 1
|
28
|
-
|
29
|
-
|
30
|
-
buffer << erb(template,
|
29
|
+
erb_opts = options.dup
|
30
|
+
erb_opts[:locals].merge!({object => member, "#{object}_counter".to_sym => counter})
|
31
|
+
buffer << erb(template, erb_opts)
|
31
32
|
end.join("\n")
|
32
33
|
else
|
33
34
|
if member = options.delete(:object)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kelredd-sinatra-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-22 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.2.
|
23
|
+
version: 0.2.3
|
24
24
|
version:
|
25
25
|
description:
|
26
26
|
email: kelly@kelredd.com
|