Module: Roda::RodaPlugins::Render::ClassMethods

Defined in:
lib/roda/plugins/render.rb

Instance Method Summary collapse

Instance Method Details

#inherited(subclass) ⇒ Object

Copy the rendering options into the subclass, duping them as necessary to prevent changes in the subclass affecting the parent class.



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/roda/plugins/render.rb', line 252

def inherited(subclass)
  super
  opts = subclass.opts[:render] = subclass.opts[:render].dup

  if opts[:cache]
    opts[:cache] = if opts[:inherit_cache]
      opts[:cache] = opts[:cache].dup
    elsif cache_class = opts[:cache_class]
      opts[:cache] = cache_class.new
    else
      opts[:cache] = thread_safe_cache
    end
  end

  opts.freeze
end

#render_optsObject

Return the render options for this class.



270
271
272
# File 'lib/roda/plugins/render.rb', line 270

def render_opts
  opts[:render]
end