Overload formats= to reject [:“/“] values.
# File lib/action_view/lookup_context.rb, line 149 149: def formats=(values) 150: if values && values.size == 1 151: value = values.first 152: values = nil if value == :"*/*" 153: values << :html if value == :js 154: end 155: super(values) 156: end
Overload locale to return a symbol instead of array.
# File lib/action_view/lookup_context.rb, line 165 165: def locale 166: @details[:locale].first 167: end
Overload locale= to also set the I18n.locale. If the current I18n.config object responds to i18n_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 172 172: def locale=(value) 173: if value 174: config = I18n.config.respond_to?(:i18n_config) ? I18n.config.i18n_config : I18n.config 175: config.locale = value 176: end 177: 178: super(@skip_default_locale ? I18n.locale : _locale_defaults) 179: end
Do not use the default locale on template lookup.
# File lib/action_view/lookup_context.rb, line 159 159: def skip_default_locale! 160: @skip_default_locale = true 161: self.locale = nil 162: 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 201 201: def update_details(new_details) 202: old_details = @details.dup 203: 204: registered_detail_setters.each do |key, setter| 205: send(setter, new_details[key]) if new_details.key?(key) 206: end 207: 208: begin 209: yield 210: ensure 211: @details_key = nil 212: @details = old_details 213: end 214: 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 183 183: def with_layout_format 184: if formats.size == 1 185: yield 186: else 187: old_formats = formats 188: _set_detail(:formats, formats[0,1]) 189: 190: begin 191: yield 192: ensure 193: _set_detail(:formats, old_formats) 194: end 195: end 196: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.