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.



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

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



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

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

#set_view_options(opts) ⇒ Object

Set branch/route options to use when rendering the view



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

def set_view_options(opts)
  if options = @_view_options
    @_view_options = Hash[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.



103
104
105
# File 'lib/roda/plugins/view_options.rb', line 103

def set_view_subdir(v)
  @_view_subdir = v
end