Temporary skip passing the details_key forward.
# File lib/action_view/lookup_context.rb, line 154 def disable_cache old_value, @cache = @cache, false yield ensure @cache = old_value end
Overload formats= to expand [“/”] values and automatically add :html as fallback to :js.
# File lib/action_view/lookup_context.rb, line 172 def formats=(values) if values values.concat(_formats_defaults) if values.delete "*/*" values << :html if values == [:js] end super(values) end
Overload locale to return a symbol instead of array.
# File lib/action_view/lookup_context.rb, line 187 def locale @details[:locale].first end
Overload locale= to also set the I18n.locale. If the current I18n.config object responds to original_config, it means that it’s has a copy of the original I18n configuration and it’s acting as proxy, which we need to skip.
# File lib/action_view/lookup_context.rb, line 194 def locale=(value) if value config = I18n.config.respond_to?(:original_config) ? I18n.config.original_config : I18n.config config.locale = value end super(@skip_default_locale ? I18n.locale : _locale_defaults) end
Do not use the default locale on template lookup.
# File lib/action_view/lookup_context.rb, line 181 def skip_default_locale! @skip_default_locale = true self.locale = nil end
Update the details keys by merging the given hash into the current details hash. If a block is given, the details are modified just during the execution of the block and reverted to the previous value after.
# File lib/action_view/lookup_context.rb, line 223 def update_details(new_details) old_details = @details.dup registered_detail_setters.each do |key, setter| send(setter, new_details[key]) if new_details.key?(key) end begin yield ensure @details_key = nil @details = old_details end end
A method which only uses the first format in the formats array for layout lookup. This method plays straight with instance variables for performance reasons.
# File lib/action_view/lookup_context.rb, line 205 def with_layout_format if formats.size == 1 yield else old_formats = formats _set_detail(:formats, formats[0,1]) begin yield ensure _set_detail(:formats, old_formats) end end end
Generated with the Darkfish Rdoc Generator 2.