lib/roda/plugins/render_each.rb in roda-2.29.0 vs lib/roda/plugins/render_each.rb in roda-3.0.0
- old
+ new
@@ -13,24 +13,21 @@
# is rendered, the local variable +foo+ will contain the given
# value (e.g. on the first rendering +foo+ is 1).
#
# You can pass additional render options via an options hash:
#
- # render_each([1,2,3], :foo, :views=>'partials')
+ # render_each([1,2,3], :foo, views: 'partials')
#
# One additional option supported by is +:local+, which sets the
# local variable containing the current value to use. So:
#
- # render_each([1,2,3], :foo, :local=>:bar)
+ # render_each([1,2,3], :foo, local: :bar)
#
# Will render the +foo+ template, but the local variable used inside
- # the template will be +bar+. You can use <tt>:local=>nil</tt> to
+ # the template will be +bar+. You can use <tt>local: nil</tt> to
# not set a local variable inside the template.
module RenderEach
- OPTS = {}.freeze
- RodaPlugins.deprecate_constant(self, :OPTS)
-
# Load the render plugin before this plugin, since this plugin
# calls the render method.
def self.load_dependencies(app)
app.plugin :render
end
@@ -40,10 +37,10 @@
# given opts. The template and options hash are passed to +render+.
# Additional options supported:
# :local :: The local variable to use for the current enum value
# inside the template. An explicit +nil+ value does not
# set a local variable. If not set, uses the template name.
- def render_each(enum, template, opts=RodaPlugins::OPTS)
+ def render_each(enum, template, opts=OPTS)
if as = opts.has_key?(:local)
as = opts[:local]
else
as = template.to_s.to_sym
end