Module: Roda::RodaPlugins::ViewOptions::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#append_view_subdir(v) ⇒ Object

Append a view subdirectory to use. If there hasn’t already been a view subdirectory set, this just sets it to the argument. If there has already been a view subdirectory set, this sets the view subdirectory to a subdirectory of the existing view subdirectory.



95
96
97
98
99
100
101
# File 'lib/roda/plugins/view_options.rb', line 95

def append_view_subdir(v)
  if subdir = @_view_subdir
    set_view_subdir("#{subdir}/#{v}")
  else
    set_view_subdir(v)
  end
end

#set_layout_options(opts) ⇒ Object

Set branch/route options to use when rendering the layout



110
111
112
113
114
115
116
# File 'lib/roda/plugins/view_options.rb', line 110

def set_layout_options(opts)
  if options = @_layout_options
    @_layout_options = options.merge!(opts)
  else
    @_layout_options = opts
  end
end

#set_view_options(opts) ⇒ Object

Set branch/route options to use when rendering the view



119
120
121
122
123
124
125
# File 'lib/roda/plugins/view_options.rb', line 119

def set_view_options(opts)
  if options = @_view_options
    @_view_options = options.merge!(opts)
  else
    @_view_options = opts
  end
end

#set_view_subdir(v) ⇒ Object

Set the view subdirectory to use. This can be set to nil to not use a view subdirectory.



105
106
107
# File 'lib/roda/plugins/view_options.rb', line 105

def set_view_subdir(v)
  @_view_subdir = v
end