From 80dcde92fd98419021e9fc7ca3a2ca747c0e9859 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 12 Jul 2024 08:06:18 -0700 Subject: [PATCH] Update website for 3.82.0 release --- documentation.html | 4 +- index.html | 2 +- rdoc/classes/Roda.html | 2 +- rdoc/classes/Roda/RodaPlugins/CaptureERB.html | 8 +- .../CaptureERB/InstanceMethods.html | 25 ++- .../RodaPlugins/PlainHashResponseHeaders.html | 2 +- rdoc/classes/Roda/RodaPlugins/Public.html | 65 +++++-- .../RodaPlugins/Public/RequestMethods.html | 6 +- rdoc/classes/Roda/RodaPlugins/Render.html | 180 +++++++++--------- .../Roda/RodaPlugins/Render/ClassMethods.html | 60 +++--- .../RodaPlugins/Render/InstanceMethods.html | 84 ++++---- .../Render/TemplateMtimeWrapper.html | 140 +++++++------- rdoc/created.rid | 15 +- rdoc/files/CHANGELOG.html | 11 +- rdoc/files/doc/release_notes/3_82_0_txt.html | 78 ++++++++ .../lib/roda/plugins/capture_erb_rb.html | 2 +- .../plain_hash_response_headers_rb.html | 2 +- rdoc/files/lib/roda/plugins/public_rb.html | 2 +- rdoc/files/lib/roda/plugins/render_rb.html | 2 +- rdoc/files/lib/roda/version_rb.html | 2 +- rdoc/fr_file_index.html | 1 + 21 files changed, 419 insertions(+), 274 deletions(-) create mode 100644 rdoc/files/doc/release_notes/3_82_0_txt.html diff --git a/documentation.html b/documentation.html index 59240347..27102da0 100644 --- a/documentation.html +++ b/documentation.html @@ -21,7 +21,7 @@
-

Documentation for Roda (v3.81.0)

+

Documentation for Roda (v3.82.0)

README (Introduction to Roda, start here if new)

@@ -252,7 +252,7 @@

Release Notes

  • - 3.81 | 3.80 + 3.82 | 3.81 | 3.80
  • diff --git a/index.html b/index.html index 970e86a3..466ca3cf 100644 --- a/index.html +++ b/index.html @@ -104,7 +104,7 @@

    A Modular, Scalable Ruby Framework

  • Simple, Reliable API -

    Currently at version 3.81.0

    +

    Currently at version 3.82.0

  • diff --git a/rdoc/classes/Roda.html b/rdoc/classes/Roda.html index 958dba1b..278db3be 100644 --- a/rdoc/classes/Roda.html +++ b/rdoc/classes/Roda.html @@ -489,7 +489,7 @@

    Constants

    RodaMinorVersion = -81 +82  

    The minor version of Roda, updated for new feature releases of Roda.

    diff --git a/rdoc/classes/Roda/RodaPlugins/CaptureERB.html b/rdoc/classes/Roda/RodaPlugins/CaptureERB.html index 6b57b7f9..40772c38 100644 --- a/rdoc/classes/Roda/RodaPlugins/CaptureERB.html +++ b/rdoc/classes/Roda/RodaPlugins/CaptureERB.html @@ -43,6 +43,8 @@

    module <% end %>

    capture_erb can be used inside other methods that are called inside templates. It can be combined with the inject_erb plugin to wrap template blocks with arbitrary output and then inject the wrapped output into the template.

    + +

    If the output buffer object responds to capture (e.g. when erubi/capture_block is being used as the template engine), this will call capture on the output buffer object, instead of setting the output buffer object temporarily to a new object.

  • Methods

    @@ -76,9 +78,9 @@

    Public Class methods

    [show source]
       # File lib/roda/plugins/capture_erb.rb
    -19 def self.load_dependencies(app)
    -20   app.plugin :render
    -21 end
    +24 def self.load_dependencies(app) +25 app.plugin :render +26 end
    diff --git a/rdoc/classes/Roda/RodaPlugins/CaptureERB/InstanceMethods.html b/rdoc/classes/Roda/RodaPlugins/CaptureERB/InstanceMethods.html index 6b63af64..f405d674 100644 --- a/rdoc/classes/Roda/RodaPlugins/CaptureERB/InstanceMethods.html +++ b/rdoc/classes/Roda/RodaPlugins/CaptureERB/InstanceMethods.html @@ -51,7 +51,7 @@

    Public Instance methods

    -capture_erb() +capture_erb(&block)
    @@ -64,14 +64,21 @@

    Public Instance methods

    [show source]
       # File lib/roda/plugins/capture_erb.rb
    -28 def capture_erb
    -29   outvar = render_opts[:template_opts][:outvar]
    -30   buf_was = instance_variable_get(outvar)
    -31   instance_variable_set(outvar, String.new)
    -32   yield.to_s
    -33 ensure
    -34   instance_variable_set(outvar, buf_was) if outvar && buf_was
    -35 end
    +33 def capture_erb(&block) +34 outvar = render_opts[:template_opts][:outvar] +35 buf_was = instance_variable_get(outvar) +36 +37 if buf_was.respond_to?(:capture) +38 buf_was.capture(&block) +39 else +40 begin +41 instance_variable_set(outvar, String.new) +42 yield.to_s +43 ensure +44 instance_variable_set(outvar, buf_was) if outvar && buf_was +45 end +46 end +47 end
    diff --git a/rdoc/classes/Roda/RodaPlugins/PlainHashResponseHeaders.html b/rdoc/classes/Roda/RodaPlugins/PlainHashResponseHeaders.html index 0c3bb47b..e6da6900 100644 --- a/rdoc/classes/Roda/RodaPlugins/PlainHashResponseHeaders.html +++ b/rdoc/classes/Roda/RodaPlugins/PlainHashResponseHeaders.html @@ -36,7 +36,7 @@

    module
    -

    The response_headers_plain_hash plugin will change Roda to use a plain hash for response headers. This is Roda’s default behavior on Rack 2, but on Rack 3+, Roda defaults to using Rack::Headers for response headers for backwards compatibility (Rack::Headers automatically lower cases header keys).

    +

    The plain_hash_response_headers plugin will change Roda to use a plain hash for response headers. This is Roda’s default behavior on Rack 2, but on Rack 3+, Roda defaults to using Rack::Headers for response headers for backwards compatibility (Rack::Headers automatically lower cases header keys).

    On Rack 3+, you should use this plugin for better performance if you are sure all headers in your application and middleware are already lower case (lower case response header keys are required by the Rack 3 spec).

    diff --git a/rdoc/classes/Roda/RodaPlugins/Public.html b/rdoc/classes/Roda/RodaPlugins/Public.html index ca7a3b86..5e911aab 100644 --- a/rdoc/classes/Roda/RodaPlugins/Public.html +++ b/rdoc/classes/Roda/RodaPlugins/Public.html @@ -82,6 +82,29 @@

    Constants

    + + + + + + + + + + + + + + + + + + + + + @@ -116,16 +139,20 @@

    Public Class methods

    Use options given to setup a Rack::File instance for serving files. Options:

    -
    ENCODING_EXTENSIONS={'br'=>'.br', 'gzip'=>'.gz', 'zstd'=>'.zst'}.freeze 
    ENCODING_MAP={:zstd=>'zstd', :brotli=>'br', :gzip=>'gzip'}.freeze 
    MATCH_METHOD=RUBY_VERSION >= '2.4' ? :match? : :match  +

    :nocov:

    +
    PARSER = URI::DEFAULT_PARSER
    :default_mime +
    :brotli +

    Whether to serve already brotli-compressed files with a .br extension for clients supporting “br” transfer encoding.

    +
    :default_mime

    The default mime type to use if the mime type is not recognized.

    +
    :encodings +

    An enumerable of pairs to handle accepted encodings. The first element of the pair is the accepted encoding name (e.g. ‘gzip’), and the second element of the pair is the file extension (e.g. ‘.gz’). This allows configuration of the order in which encodings are tried, to prefer brotli to zstd for example, or to support encodings other than zstd, brotli, and gzip. This takes precedence over the :brotli, :gzip, and :zstd options if given.

    :gzip -

    Whether to serve already gzipped files with a .gz extension for clients supporting gzipped transfer encoding.

    -
    :brotli -

    Whether to serve already brotli-compressed files with a .br extension for clients supporting brotli transfer encoding.

    +

    Whether to serve already gzipped files with a .gz extension for clients supporting “gzip” transfer encoding.

    :headers

    A hash of headers to use for statically served files

    :root

    Use this option for the root of the public directory (default: “public”)

    +
    :zstd +

    Whether to serve already zstd-compressed files with a .zst extension for clients supporting “zstd” transfer encoding.

    @@ -134,16 +161,26 @@

    Public Class methods

    [show source]
       # File lib/roda/plugins/public.rb
    -56 def self.configure(app, opts={})
    -57   if opts[:root]
    -58     app.opts[:public_root] = app.expand_path(opts[:root])
    -59   elsif !app.opts[:public_root]
    -60     app.opts[:public_root] = app.expand_path("public")
    -61   end
    -62   app.opts[:public_server] = RACK_FILES.new(app.opts[:public_root], opts[:headers]||{}, opts[:default_mime] || 'text/plain')
    -63   app.opts[:public_gzip] = opts[:gzip]
    -64   app.opts[:public_brotli] = opts[:brotli]
    -65 end
    +71 def self.configure(app, opts={}) +72 if opts[:root] +73 app.opts[:public_root] = app.expand_path(opts[:root]) +74 elsif !app.opts[:public_root] +75 app.opts[:public_root] = app.expand_path("public") +76 end +77 app.opts[:public_server] = RACK_FILES.new(app.opts[:public_root], opts[:headers]||{}, opts[:default_mime] || 'text/plain') +78 +79 unless encodings = opts[:encodings] +80 if ENCODING_MAP.any?{|k,| opts.has_key?(k)} +81 encodings = ENCODING_MAP.map{|k, v| [v, ENCODING_EXTENSIONS[v]] if opts[k]}.compact +82 end +83 end +84 encodings = (encodings || app.opts[:public_encodings] || EMPTY_ARRAY).map(&:dup).freeze +85 encodings.each do |a| +86 a << /\b#{a[0]}\b/ +87 end +88 encodings.each(&:freeze) +89 app.opts[:public_encodings] = encodings +90 end diff --git a/rdoc/classes/Roda/RodaPlugins/Public/RequestMethods.html b/rdoc/classes/Roda/RodaPlugins/Public/RequestMethods.html index 0a560a9f..a3ee26eb 100644 --- a/rdoc/classes/Roda/RodaPlugins/Public/RequestMethods.html +++ b/rdoc/classes/Roda/RodaPlugins/Public/RequestMethods.html @@ -64,9 +64,9 @@

    Public Instance methods

    [show source]
       # File lib/roda/plugins/public.rb
    -69 def public
    -70   public_serve_with(roda_class.opts[:public_server])
    -71 end
    +94 def public +95 public_serve_with(roda_class.opts[:public_server]) +96 end diff --git a/rdoc/classes/Roda/RodaPlugins/Render.html b/rdoc/classes/Roda/RodaPlugins/Render.html index a6a01010..cd4430e1 100644 --- a/rdoc/classes/Roda/RodaPlugins/Render.html +++ b/rdoc/classes/Roda/RodaPlugins/Render.html @@ -164,6 +164,16 @@

    Roda, you have a few different options you can use.

    +

    Use Erubi::CaptureBlockEngine

    + +

    Roda defaults to using Erubi for erb template rendering. Erubi 1.13.0+ includes support for an erb variant that supports blocks in <%= and <%== tags. To use it:

    + +
    require 'erubi/capture_block'
    +plugin :render, template_opts: {engine_class: Erubi::CaptureBlockEngine}
    +
    + +

    See the Erubi documentation for how to capture data inside the block. Make sure the method call (some_method in the example) returns the output you want added to the rendered body.

    +

    Directly Inject Template Output

    You can switch from a <%= tag to using a <% tag:

    @@ -275,91 +285,91 @@

    Public Class methods

    [show source]
        # File lib/roda/plugins/render.rb
    -232 def self.configure(app, opts=OPTS)
    -233   if app.opts[:render]
    -234     orig_cache = app.opts[:render][:cache]
    -235     orig_method_cache = app.opts[:render][:template_method_cache]
    -236     opts = app.opts[:render][:orig_opts].merge(opts)
    -237   end
    -238   app.opts[:render] = opts.dup
    -239   app.opts[:render][:orig_opts] = opts
    -240 
    -241   opts = app.opts[:render]
    -242   opts[:engine] = (opts[:engine] || "erb").dup.freeze
    -243   opts[:views] = app.expand_path(opts[:views]||"views").freeze
    -244   opts[:allowed_paths] ||= [opts[:views]].freeze
    -245   opts[:allowed_paths] = opts[:allowed_paths].map{|f| app.expand_path(f, nil)}.uniq.freeze
    -246   opts[:check_paths] = true unless opts.has_key?(:check_paths)
    -247 
    -248   unless opts.has_key?(:check_template_mtime)
    -249     opts[:check_template_mtime] = if opts[:cache] == false || opts[:explicit_cache]
    -250       true
    -251     else
    -252       ENV['RACK_ENV'] == 'development'
    -253     end
    -254   end
    -255 
    -256   begin
    -257     app.const_get(:RodaCompiledTemplates, false)
    -258   rescue NameError
    -259     compiled_templates_module = Module.new
    -260     app.send(:include, compiled_templates_module)
    -261     app.const_set(:RodaCompiledTemplates, compiled_templates_module)
    -262   end
    -263   opts[:template_method_cache] = orig_method_cache || (opts[:cache_class] || RodaCache).new
    -264   opts[:template_method_cache][:_roda_layout] = nil if opts[:template_method_cache][:_roda_layout]
    -265   opts[:cache] = orig_cache || (opts[:cache_class] || RodaCache).new
    -266 
    -267   opts[:layout_opts] = (opts[:layout_opts] || {}).dup
    -268   opts[:layout_opts][:_is_layout] = true
    -269   if opts[:layout_opts][:views]
    -270     opts[:layout_opts][:views] = app.expand_path(opts[:layout_opts][:views]).freeze
    -271   end
    -272 
    -273   if layout = opts.fetch(:layout, true)
    -274     opts[:layout] = true
    -275 
    -276     case layout
    -277     when Hash
    -278       opts[:layout_opts].merge!(layout)
    -279     when true
    -280       opts[:layout_opts][:template] ||= 'layout'
    -281     else
    -282       opts[:layout_opts][:template] = layout
    -283     end
    -284 
    -285     opts[:optimize_layout] = (opts[:layout_opts][:template] if opts[:layout_opts].keys.sort == [:_is_layout, :template])
    -286   end
    -287   opts[:layout_opts].freeze
    +245 def self.configure(app, opts=OPTS)
    +246   if app.opts[:render]
    +247     orig_cache = app.opts[:render][:cache]
    +248     orig_method_cache = app.opts[:render][:template_method_cache]
    +249     opts = app.opts[:render][:orig_opts].merge(opts)
    +250   end
    +251   app.opts[:render] = opts.dup
    +252   app.opts[:render][:orig_opts] = opts
    +253 
    +254   opts = app.opts[:render]
    +255   opts[:engine] = (opts[:engine] || "erb").dup.freeze
    +256   opts[:views] = app.expand_path(opts[:views]||"views").freeze
    +257   opts[:allowed_paths] ||= [opts[:views]].freeze
    +258   opts[:allowed_paths] = opts[:allowed_paths].map{|f| app.expand_path(f, nil)}.uniq.freeze
    +259   opts[:check_paths] = true unless opts.has_key?(:check_paths)
    +260 
    +261   unless opts.has_key?(:check_template_mtime)
    +262     opts[:check_template_mtime] = if opts[:cache] == false || opts[:explicit_cache]
    +263       true
    +264     else
    +265       ENV['RACK_ENV'] == 'development'
    +266     end
    +267   end
    +268 
    +269   begin
    +270     app.const_get(:RodaCompiledTemplates, false)
    +271   rescue NameError
    +272     compiled_templates_module = Module.new
    +273     app.send(:include, compiled_templates_module)
    +274     app.const_set(:RodaCompiledTemplates, compiled_templates_module)
    +275   end
    +276   opts[:template_method_cache] = orig_method_cache || (opts[:cache_class] || RodaCache).new
    +277   opts[:template_method_cache][:_roda_layout] = nil if opts[:template_method_cache][:_roda_layout]
    +278   opts[:cache] = orig_cache || (opts[:cache_class] || RodaCache).new
    +279 
    +280   opts[:layout_opts] = (opts[:layout_opts] || {}).dup
    +281   opts[:layout_opts][:_is_layout] = true
    +282   if opts[:layout_opts][:views]
    +283     opts[:layout_opts][:views] = app.expand_path(opts[:layout_opts][:views]).freeze
    +284   end
    +285 
    +286   if layout = opts.fetch(:layout, true)
    +287     opts[:layout] = true
     288 
    -289   template_opts = opts[:template_opts] = (opts[:template_opts] || {}).dup
    -290   template_opts[:outvar] ||= '@_out_buf'
    -291   unless template_opts.has_key?(:default_encoding)
    -292     template_opts[:default_encoding] = Encoding.default_external
    -293   end
    -294 
    -295   engine_opts = opts[:engine_opts] = (opts[:engine_opts] || {}).dup
    -296   engine_opts.to_a.each do |k,v|
    -297     engine_opts[k] = v.dup.freeze
    -298   end
    -299 
    -300   if escape = opts[:escape]
    -301     require 'tilt/erubi'
    -302 
    -303     case escape
    -304     when String, Array
    -305       Array(escape).each do |engine|
    -306         engine_opts[engine] = (engine_opts[engine] || {}).merge(:escape => true).freeze
    -307       end
    -308     else
    -309       template_opts[:escape] = true
    -310     end
    +289     case layout
    +290     when Hash
    +291       opts[:layout_opts].merge!(layout)
    +292     when true
    +293       opts[:layout_opts][:template] ||= 'layout'
    +294     else
    +295       opts[:layout_opts][:template] = layout
    +296     end
    +297 
    +298     opts[:optimize_layout] = (opts[:layout_opts][:template] if opts[:layout_opts].keys.sort == [:_is_layout, :template])
    +299   end
    +300   opts[:layout_opts].freeze
    +301 
    +302   template_opts = opts[:template_opts] = (opts[:template_opts] || {}).dup
    +303   template_opts[:outvar] ||= '@_out_buf'
    +304   unless template_opts.has_key?(:default_encoding)
    +305     template_opts[:default_encoding] = Encoding.default_external
    +306   end
    +307 
    +308   engine_opts = opts[:engine_opts] = (opts[:engine_opts] || {}).dup
    +309   engine_opts.to_a.each do |k,v|
    +310     engine_opts[k] = v.dup.freeze
     311   end
     312 
    -313   template_opts.freeze
    -314   engine_opts.freeze
    -315   opts.freeze
    -316 end
    +313 if escape = opts[:escape] +314 require 'tilt/erubi' +315 +316 case escape +317 when String, Array +318 Array(escape).each do |engine| +319 engine_opts[engine] = (engine_opts[engine] || {}).merge(:escape => true).freeze +320 end +321 else +322 template_opts[:escape] = true +323 end +324 end +325 +326 template_opts.freeze +327 engine_opts.freeze +328 opts.freeze +329 end
    @@ -376,9 +386,9 @@

    Public Class methods

    [show source]
        # File lib/roda/plugins/render.rb
    -220 def self.tilt_template_compiled_method(template, locals_keys, scope_class)
    -221   template.send(:compiled_method, locals_keys, scope_class)
    -222 end
    +233 def self.tilt_template_compiled_method(template, locals_keys, scope_class) +234 template.send(:compiled_method, locals_keys, scope_class) +235 end
    diff --git a/rdoc/classes/Roda/RodaPlugins/Render/ClassMethods.html b/rdoc/classes/Roda/RodaPlugins/Render/ClassMethods.html index 0bd587ec..bb3c6274 100644 --- a/rdoc/classes/Roda/RodaPlugins/Render/ClassMethods.html +++ b/rdoc/classes/Roda/RodaPlugins/Render/ClassMethods.html @@ -68,9 +68,9 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -445 def create_template(opts, template_opts)
    -446   opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block])
    -447 end
    +458 def create_template(opts, template_opts) +459 opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block]) +460 end
    @@ -89,18 +89,18 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -430 def freeze
    -431   begin
    -432     _freeze_layout_method
    -433   rescue
    -434     # This is only for optimization, if any errors occur, they can be ignored.
    -435     # One possibility for error is the app doesn't use a layout, but doesn't
    -436     # specifically set the :layout=>false plugin option.
    -437     nil
    -438   end
    -439 
    -440   super
    -441 end
    +443 def freeze +444 begin +445 _freeze_layout_method +446 rescue +447 # This is only for optimization, if any errors occur, they can be ignored. +448 # One possibility for error is the app doesn't use a layout, but doesn't +449 # specifically set the :layout=>false plugin option. +450 nil +451 end +452 +453 super +454 end
    @@ -119,15 +119,15 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -458 def inherited(subclass)
    -459   super
    -460   opts = subclass.opts[:render] = subclass.opts[:render].dup
    -461   if COMPILED_METHOD_SUPPORT
    -462     opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new
    -463   end
    -464   opts[:cache] = opts[:cache].dup
    -465   opts.freeze
    -466 end
    +471 def inherited(subclass) +472 super +473 opts = subclass.opts[:render] = subclass.opts[:render].dup +474 if COMPILED_METHOD_SUPPORT +475 opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new +476 end +477 opts[:cache] = opts[:cache].dup +478 opts.freeze +479 end
    @@ -146,9 +146,9 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -451 def inline_template_block(content)
    -452   Proc.new{content}
    -453 end
    +464 def inline_template_block(content) +465 Proc.new{content} +466 end
    @@ -167,9 +167,9 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -469 def render_opts
    -470   opts[:render]
    -471 end
    +482 def render_opts +483 opts[:render] +484 end
    diff --git a/rdoc/classes/Roda/RodaPlugins/Render/InstanceMethods.html b/rdoc/classes/Roda/RodaPlugins/Render/InstanceMethods.html index 4ac3c19f..1b8735dd 100644 --- a/rdoc/classes/Roda/RodaPlugins/Render/InstanceMethods.html +++ b/rdoc/classes/Roda/RodaPlugins/Render/InstanceMethods.html @@ -66,16 +66,16 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -497 def render(template, opts = (no_opts = true; optimized_template = _cached_template_method(template); OPTS), &block)
    -498   if optimized_template
    -499     send(optimized_template, OPTS, &block)
    -500   elsif !no_opts && opts.length == 1 && (locals = opts[:locals]) && (optimized_template = _optimized_render_method_for_locals(template, locals))
    -501     send(optimized_template, locals, &block)
    -502   else
    -503     opts = render_template_opts(template, opts)
    -504     retrieve_template(opts).render((opts[:scope]||self), (opts[:locals]||OPTS), &block)
    -505   end
    -506 end
    +510 def render(template, opts = (no_opts = true; optimized_template = _cached_template_method(template); OPTS), &block) +511 if optimized_template +512 send(optimized_template, OPTS, &block) +513 elsif !no_opts && opts.length == 1 && (locals = opts[:locals]) && (optimized_template = _optimized_render_method_for_locals(template, locals)) +514 send(optimized_template, locals, &block) +515 else +516 opts = render_template_opts(template, opts) +517 retrieve_template(opts).render((opts[:scope]||self), (opts[:locals]||OPTS), &block) +518 end +519 end
    @@ -94,9 +94,9 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -509 def render_opts
    -510   self.class.render_opts
    -511 end
    +522 def render_opts +523 self.class.render_opts +524 end
    @@ -115,35 +115,35 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -518 def view(template, opts = (content = _optimized_view_content(template) unless defined?(yield); OPTS), &block)
    -519   if content
    -520     # First, check if the optimized layout method has already been created,
    -521     # and use it if so.  This way avoids the extra conditional and local variable
    -522     # assignments in the next section.
    -523     if layout_method = _layout_method
    -524       return send(layout_method, OPTS){content}
    -525     end
    -526 
    -527     # If we have an optimized template method but no optimized layout method, create the
    -528     # optimized layout method if possible and use it.  If you can't create the optimized
    -529     # layout method, fall through to the slower approach.
    -530     if layout_template = self.class.opts[:render][:optimize_layout]
    -531       retrieve_template(:template=>layout_template, :cache_key=>nil, :template_method_cache_key => :_roda_layout)
    -532       if layout_method = _layout_method
    -533         return send(layout_method, OPTS){content}
    -534       end
    -535     end
    -536   else
    -537     opts = parse_template_opts(template, opts)
    -538     content = opts[:content] || render_template(opts, &block)
    -539   end
    -540 
    -541   if layout_opts  = view_layout_opts(opts)
    -542     content = render_template(layout_opts){content}
    -543   end
    -544 
    -545   content
    -546 end
    +531 def view(template, opts = (content = _optimized_view_content(template) unless defined?(yield); OPTS), &block) +532 if content +533 # First, check if the optimized layout method has already been created, +534 # and use it if so. This way avoids the extra conditional and local variable +535 # assignments in the next section. +536 if layout_method = _layout_method +537 return send(layout_method, OPTS){content} +538 end +539 +540 # If we have an optimized template method but no optimized layout method, create the +541 # optimized layout method if possible and use it. If you can't create the optimized +542 # layout method, fall through to the slower approach. +543 if layout_template = self.class.opts[:render][:optimize_layout] +544 retrieve_template(:template=>layout_template, :cache_key=>nil, :template_method_cache_key => :_roda_layout) +545 if layout_method = _layout_method +546 return send(layout_method, OPTS){content} +547 end +548 end +549 else +550 opts = parse_template_opts(template, opts) +551 content = opts[:content] || render_template(opts, &block) +552 end +553 +554 if layout_opts = view_layout_opts(opts) +555 content = render_template(layout_opts){content} +556 end +557 +558 content +559 end
    diff --git a/rdoc/classes/Roda/RodaPlugins/Render/TemplateMtimeWrapper.html b/rdoc/classes/Roda/RodaPlugins/Render/TemplateMtimeWrapper.html index e3525231..aaf88f07 100644 --- a/rdoc/classes/Roda/RodaPlugins/Render/TemplateMtimeWrapper.html +++ b/rdoc/classes/Roda/RodaPlugins/Render/TemplateMtimeWrapper.html @@ -77,17 +77,17 @@

    Public Class methods

    [show source]
        # File lib/roda/plugins/render.rb
    -323 def initialize(roda_class, opts, template_opts)
    -324   @roda_class = roda_class
    -325   @opts = opts
    -326   @template_opts = template_opts
    -327   reset_template
    -328 
    -329   @path = opts[:path]
    -330   deps = opts[:dependencies]
    -331   @dependencies = ([@path] + Array(deps)) if deps
    -332   @mtime = template_last_modified
    -333 end
    +336 def initialize(roda_class, opts, template_opts) +337 @roda_class = roda_class +338 @opts = opts +339 @template_opts = template_opts +340 reset_template +341 +342 @path = opts[:path] +343 deps = opts[:dependencies] +344 @dependencies = ([@path] + Array(deps)) if deps +345 @mtime = template_last_modified +346 end

    Public Instance methods

    @@ -107,9 +107,9 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -396 def compiled_method(locals_keys=EMPTY_ARRAY, roda_class=nil)
    -397   Render.tilt_template_compiled_method(@template, locals_keys, roda_class)
    -398 end
    +409 def compiled_method(locals_keys=EMPTY_ARRAY, roda_class=nil) +410 Render.tilt_template_compiled_method(@template, locals_keys, roda_class) +411 end
    @@ -128,18 +128,18 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -403 def compiled_method_lambda(roda_class, method_name, locals_keys=EMPTY_ARRAY)
    -404   mod = roda_class::RodaCompiledTemplates
    -405   template = self
    -406   lambda do |locals, &block|
    -407     template.if_modified do
    -408       mod.send(:define_method, method_name, Render.tilt_template_compiled_method(template, locals_keys, roda_class))
    -409       mod.send(:private, method_name)
    -410     end
    -411 
    -412     send(method_name, locals, &block)
    -413   end
    -414 end
    +416 def compiled_method_lambda(roda_class, method_name, locals_keys=EMPTY_ARRAY) +417 mod = roda_class::RodaCompiledTemplates +418 template = self +419 lambda do |locals, &block| +420 template.if_modified do +421 mod.send(:define_method, method_name, Render.tilt_template_compiled_method(template, locals_keys, roda_class)) +422 mod.send(:private, method_name) +423 end +424 +425 send(method_name, locals, &block) +426 end +427 end
    @@ -158,21 +158,21 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -377 def define_compiled_method(roda_class, method_name, locals_keys=EMPTY_ARRAY)
    -378   mod = roda_class::RodaCompiledTemplates
    -379   internal_method_name = :"_#{method_name}"
    -380   begin
    -381     mod.send(:define_method, internal_method_name, compiled_method(locals_keys, roda_class))
    -382   rescue ::NotImplementedError
    -383     return false
    -384   end
    -385 
    -386   mod.send(:private, internal_method_name)
    -387   mod.send(:define_method, method_name, &compiled_method_lambda(roda_class, internal_method_name, locals_keys))
    -388   mod.send(:private, method_name)
    -389 
    -390   method_name
    -391 end
    +390 def define_compiled_method(roda_class, method_name, locals_keys=EMPTY_ARRAY) +391 mod = roda_class::RodaCompiledTemplates +392 internal_method_name = :"_#{method_name}" +393 begin +394 mod.send(:define_method, internal_method_name, compiled_method(locals_keys, roda_class)) +395 rescue ::NotImplementedError +396 return false +397 end +398 +399 mod.send(:private, internal_method_name) +400 mod.send(:define_method, method_name, &compiled_method_lambda(roda_class, internal_method_name, locals_keys)) +401 mod.send(:private, method_name) +402 +403 method_name +404 end
    @@ -191,19 +191,19 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -360 def if_modified
    -361   begin
    -362     mtime = template_last_modified
    -363   rescue
    -364     # ignore errors
    -365   else
    -366     if mtime != @mtime
    -367       reset_template
    -368       yield
    -369       @mtime = mtime
    -370     end
    -371   end
    -372 end
    +373 def if_modified +374 begin +375 mtime = template_last_modified +376 rescue +377 # ignore errors +378 else +379 if mtime != @mtime +380 reset_template +381 yield +382 @mtime = mtime +383 end +384 end +385 end
    @@ -222,15 +222,15 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -337 def render(*args, &block)
    -338   res = nil
    -339   modified = false
    -340   if_modified do
    -341     res = @template.render(*args, &block)
    -342     modified = true
    -343   end
    -344   modified ? res : @template.render(*args, &block)
    -345 end
    +350 def render(*args, &block) +351 res = nil +352 modified = false +353 if_modified do +354 res = @template.render(*args, &block) +355 modified = true +356 end +357 modified ? res : @template.render(*args, &block) +358 end
    @@ -249,13 +249,13 @@

    Public Instance methods

    [show source]
        # File lib/roda/plugins/render.rb
    -350 def template_last_modified
    -351   if deps = @dependencies
    -352     deps.map{|f| File.mtime(f)}.max
    -353   else
    -354     File.mtime(@path)
    -355   end
    -356 end
    +363 def template_last_modified +364 if deps = @dependencies +365 deps.map{|f| File.mtime(f)}.max +366 else +367 File.mtime(@path) +368 end +369 end
    diff --git a/rdoc/created.rid b/rdoc/created.rid index 4db8a965..79b3f885 100644 --- a/rdoc/created.rid +++ b/rdoc/created.rid @@ -1,6 +1,6 @@ -Wed, 12 Jun 2024 08:43:47 -0700 +Fri, 12 Jul 2024 08:06:06 -0700 README.rdoc Wed, 18 Oct 2023 15:53:01 -0700 -CHANGELOG Wed, 12 Jun 2024 08:35:42 -0700 +CHANGELOG Fri, 12 Jul 2024 07:56:42 -0700 doc/CHANGELOG.old Fri, 11 Mar 2022 10:33:07 -0800 MIT-LICENSE Thu, 12 Jan 2023 07:50:45 -0800 lib/roda.rb Mon, 14 Aug 2023 09:53:11 -0700 @@ -23,7 +23,7 @@ lib/roda/plugins/backtracking_array.rb Mon, 22 Jun 2020 15:56:02 -0700 lib/roda/plugins/branch_locals.rb Wed, 06 Mar 2019 07:42:46 -0800 lib/roda/plugins/break.rb Fri, 15 Dec 2023 09:54:59 -0800 lib/roda/plugins/caching.rb Mon, 19 Jun 2023 16:20:51 -0700 -lib/roda/plugins/capture_erb.rb Tue, 02 Nov 2021 13:25:06 -0700 +lib/roda/plugins/capture_erb.rb Mon, 17 Jun 2024 16:25:38 -0700 lib/roda/plugins/chunked.rb Mon, 19 Jun 2023 16:20:51 -0700 lib/roda/plugins/class_level_routing.rb Mon, 22 Jun 2020 15:56:02 -0700 lib/roda/plugins/class_matchers.rb Tue, 23 May 2023 09:08:39 -0700 @@ -101,14 +101,14 @@ lib/roda/plugins/path_matchers.rb Wed, 16 Aug 2017 08:44:25 -0700 lib/roda/plugins/path_rewriter.rb Wed, 16 Aug 2017 08:44:25 -0700 lib/roda/plugins/permissions_policy.rb Tue, 12 Mar 2024 10:38:13 -0700 lib/roda/plugins/placeholder_string_matchers.rb Thu, 16 Apr 2020 13:01:43 -0700 -lib/roda/plugins/plain_hash_response_headers.rb Mon, 19 Jun 2023 16:20:51 -0700 +lib/roda/plugins/plain_hash_response_headers.rb Fri, 05 Jul 2024 08:01:57 -0700 lib/roda/plugins/precompile_templates.rb Wed, 13 Jan 2021 12:42:16 -0800 -lib/roda/plugins/public.rb Mon, 19 Jun 2023 16:20:51 -0700 +lib/roda/plugins/public.rb Tue, 02 Jul 2024 15:37:01 -0700 lib/roda/plugins/r.rb Thu, 13 Aug 2020 12:32:01 -0700 lib/roda/plugins/recheck_precompiled_assets.rb Thu, 18 Feb 2021 14:23:19 -0800 lib/roda/plugins/redirect_http_to_https.rb Wed, 18 Oct 2023 14:59:20 -0700 lib/roda/plugins/relative_path.rb Mon, 14 Dec 2020 12:59:45 -0800 -lib/roda/plugins/render.rb Wed, 03 Apr 2024 15:44:47 -0700 +lib/roda/plugins/render.rb Fri, 14 Jun 2024 10:16:38 -0700 lib/roda/plugins/render_coverage.rb Fri, 10 Mar 2023 10:19:46 -0800 lib/roda/plugins/render_each.rb Mon, 12 Sep 2022 13:47:50 -0700 lib/roda/plugins/render_locals.rb Mon, 12 Sep 2022 13:47:50 -0700 @@ -142,7 +142,7 @@ lib/roda/plugins/view_options.rb Mon, 12 Sep 2022 13:47:50 -0700 lib/roda/request.rb Fri, 17 Mar 2023 08:33:20 -0700 lib/roda/response.rb Fri, 23 Feb 2024 14:44:14 -0800 lib/roda/session_middleware.rb Sun, 04 Aug 2019 14:34:46 -0700 -lib/roda/version.rb Wed, 12 Jun 2024 08:35:42 -0700 +lib/roda/version.rb Fri, 12 Jul 2024 07:56:42 -0700 doc/conventions.rdoc Mon, 16 Oct 2023 12:10:05 -0700 doc/release_notes/1.0.0.txt Tue, 19 Aug 2014 09:04:25 -0700 doc/release_notes/1.1.0.txt Tue, 11 Nov 2014 11:35:26 -0800 @@ -261,4 +261,5 @@ doc/release_notes/3.79.0.txt Fri, 12 Apr 2024 07:38:02 -0700 doc/release_notes/3.8.0.txt Thu, 17 May 2018 13:49:47 -0700 doc/release_notes/3.80.0.txt Fri, 10 May 2024 08:34:52 -0700 doc/release_notes/3.81.0.txt Wed, 12 Jun 2024 08:35:42 -0700 +doc/release_notes/3.82.0.txt Fri, 12 Jul 2024 07:56:42 -0700 doc/release_notes/3.9.0.txt Mon, 11 Jun 2018 12:33:07 -0700 diff --git a/rdoc/files/CHANGELOG.html b/rdoc/files/CHANGELOG.html index d2d4f6d0..8b1137d9 100644 --- a/rdoc/files/CHANGELOG.html +++ b/rdoc/files/CHANGELOG.html @@ -31,12 +31,21 @@

    CHANGELOG
    Last Update: -2024-06-12 08:35:42 -0700 +2024-07-12 07:56:42 -0700
    +

    3.82.0 (2024-07-12)

    +
    • +

      Add :encodings option to public plugin to support configurable encoding order (jeremyevans)

      +
    • +

      Add :zstd option to public plugin to supplement it to serve zstd-compressed files with .zst extension (jeremyevans)

      +
    • +

      Make capture_erb plugin call integrate better with erubi/capture_block (jeremyevans)

      +
    +

    3.81.0 (2024-06-12)

    • Make assets plugin :early_hints option follow Rack 3 SPEC if using Rack 3 (jeremyevans)

      diff --git a/rdoc/files/doc/release_notes/3_82_0_txt.html b/rdoc/files/doc/release_notes/3_82_0_txt.html new file mode 100644 index 00000000..d7719279 --- /dev/null +++ b/rdoc/files/doc/release_notes/3_82_0_txt.html @@ -0,0 +1,78 @@ + + + +3.82.0.txt + + + + + + +
      +
      +

      3.82.0.txt +

      +
      +doc/release_notes/3.82.0.txt +
      +
      +Last Update: +2024-07-12 07:56:42 -0700 +
      +
      +
      +
      +
      +

      New Features

      +
      • +

        A :zstd option has been added to the public and multi_public plugins to support serving zstd-compressed files with a .zst extension. This option is similar to the existing :gzip and :brotli plugin options. Chrome started supporting zstd encoding in March.

        +
      • +

        An :encodings option has been added to the public and multi_public plugins, for more control over how encodings are handled. This allows for changing the order in which encodings are attempted, the use of custom encodings, and the use of different file extensions for encodings. Example:

        + +
        plugin :public, encodings: {'zstd'=>'.zst', 'deflate'=>'.deflate'}
        +
        + +

        If the :encodings option is not provided, the :zstd, :brotli, and :gzip options are used to build an equivalent :encodings option.

        +
      + +

      Other Improvements

      +
      • +

        The capture_erb plugin now integrates better when using erubi/capture_block for <%= method do %> support in ERB templates, using the native capture method provided by the buffer object.

        +
      • +

        Encoding handling has been more optimized in the public plugin. Regexps for the encodings are precomputed, avoiding a regexp allocation per request per encoding attempted. On Ruby 2.4+ Regexp#match? is used for better performance. If the Accept-Encoding header is not present, no encoding matching is attemped.

        +
      + +

      Backwards Compatibility

      +
      • +

        The private public_serve_compressed request method in the public plugin now assumes it is called after the encoding is already valid. If you are calling this method in your own code, you now need to perform checks to make sure the client can accept the encoding before calling this method.

        +
      • +

        The :public_gzip and :public_brotli application options are no longer set by the public plugin. The :public_encodings option is now set.

        +
      +
      +
      +
      + +
      +
      + + +
      + + + diff --git a/rdoc/files/lib/roda/plugins/capture_erb_rb.html b/rdoc/files/lib/roda/plugins/capture_erb_rb.html index 17250ffe..489edfc7 100644 --- a/rdoc/files/lib/roda/plugins/capture_erb_rb.html +++ b/rdoc/files/lib/roda/plugins/capture_erb_rb.html @@ -31,7 +31,7 @@

      capture_erb.rb

    Last Update: -2021-11-02 13:25:06 -0700 +2024-06-17 16:25:38 -0700
    diff --git a/rdoc/files/lib/roda/plugins/plain_hash_response_headers_rb.html b/rdoc/files/lib/roda/plugins/plain_hash_response_headers_rb.html index 736e621d..27f4de2e 100644 --- a/rdoc/files/lib/roda/plugins/plain_hash_response_headers_rb.html +++ b/rdoc/files/lib/roda/plugins/plain_hash_response_headers_rb.html @@ -31,7 +31,7 @@

    plain_hash_response_headers.rb

    Last Update: -2023-06-19 16:20:51 -0700 +2024-07-05 08:01:57 -0700
    diff --git a/rdoc/files/lib/roda/plugins/public_rb.html b/rdoc/files/lib/roda/plugins/public_rb.html index 51ad6bae..491ea121 100644 --- a/rdoc/files/lib/roda/plugins/public_rb.html +++ b/rdoc/files/lib/roda/plugins/public_rb.html @@ -31,7 +31,7 @@

    public.rb

    Last Update: -2023-06-19 16:20:51 -0700 +2024-07-02 15:37:01 -0700
    diff --git a/rdoc/files/lib/roda/plugins/render_rb.html b/rdoc/files/lib/roda/plugins/render_rb.html index 657d96cc..e2a30f7e 100644 --- a/rdoc/files/lib/roda/plugins/render_rb.html +++ b/rdoc/files/lib/roda/plugins/render_rb.html @@ -31,7 +31,7 @@

    render.rb

    Last Update: -2024-04-03 15:44:47 -0700 +2024-06-14 10:16:38 -0700
    diff --git a/rdoc/files/lib/roda/version_rb.html b/rdoc/files/lib/roda/version_rb.html index dbd00c38..f7a26fc0 100644 --- a/rdoc/files/lib/roda/version_rb.html +++ b/rdoc/files/lib/roda/version_rb.html @@ -31,7 +31,7 @@

    version.rb

    Last Update: -2024-06-12 08:35:42 -0700 +2024-07-12 07:56:42 -0700
    diff --git a/rdoc/fr_file_index.html b/rdoc/fr_file_index.html index 0c7c32cd..bf5552e0 100644 --- a/rdoc/fr_file_index.html +++ b/rdoc/fr_file_index.html @@ -132,6 +132,7 @@
  • 3.8.0.txt
  • 3.80.0.txt
  • 3.81.0.txt
  • +
  • 3.82.0.txt
  • 3.9.0.txt
  • roda.rb
  • cache.rb