Module: Roda::RodaPlugins::HashBranchViewSubdir

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

Overview

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

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.configure(app) ⇒ Object



31
32
33
# File 'lib/roda/plugins/hash_branch_view_subdir.rb', line 31

def self.configure(app)
  app.opts[:hash_branch_view_subdir_methods] ||= {}
end

.load_dependencies(app) ⇒ Object



26
27
28
29
# File 'lib/roda/plugins/hash_branch_view_subdir.rb', line 26

def self.load_dependencies(app)
  app.plugin :hash_branches
  app.plugin :view_options
end