module Roda::RodaPlugins::HashBranchViewSubdir

  1. lib/roda/plugins/hash_branch_view_subdir.rb

The hash_branch_view_subdir plugin builds on the hash_branches and view_options plugins, automatically appending a view subdirectory for any matching hash branch taken. In cases where you are using a separate view subdirectory per hash branch, this can result in DRYer code. Example:

plugin :hash_branch_view_subdir

route do |r|
  r.hash_branches
end

hash_branch 'foo' do |r|
  # view subdirectory here is 'foo'
  r.hash_branches('foo')
end

hash_branch 'foo', 'bar' do |r|
  # view subdirectory here is 'foo/bar'
end

Methods

Public Class

  1. configure
  2. load_dependencies

Public Class methods

configure(app)
[show source]
   # File lib/roda/plugins/hash_branch_view_subdir.rb
31 def self.configure(app)
32   app.opts[:hash_branch_view_subdir_methods] ||= {}
33 end
load_dependencies(app)
[show source]
   # File lib/roda/plugins/hash_branch_view_subdir.rb
26 def self.load_dependencies(app)
27   app.plugin :hash_branches
28   app.plugin :view_options
29 end