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_locals(opts) ⇒ Object

RODA3: Remove



126
127
128
129
130
131
132
133
# File 'lib/roda/plugins/view_options.rb', line 126

def set_layout_locals(opts)
  RodaPlugins.warn "The set_layout_locals method in the view_options plugin is deprecated and will be removed in Roda 3. This feature has been moved to the branch_locals plugin."
  if locals = @_layout_locals
    @_layout_locals = Hash[locals].merge!(opts)
  else
    @_layout_locals = opts
  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_locals(opts) ⇒ Object

RODA3: Remove



136
137
138
139
140
141
142
143
# File 'lib/roda/plugins/view_options.rb', line 136

def set_view_locals(opts)
  RodaPlugins.warn "The set_view_locals method in the view_options plugin is deprecated and will be removed in Roda 3. This feature has been moved to the branch_locals plugin."
  if locals = @_view_locals
    @_view_locals = Hash[locals].merge!(opts)
  else
    @_view_locals = 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