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.



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

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



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

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



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

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.



107
108
109
# File 'lib/roda/plugins/view_options.rb', line 107

def set_view_subdir(v)
  @_view_subdir = v
end