def initialize(view_paths, details = {}, prefixes = [])
@details, @details_key = {}, nil
@skip_default_locale = false
@cache = true
@prefixes = prefixes
@rendered_format = nil
self.view_paths = view_paths
initialize_details(details)
end
# 也就是:
@cache=true,
@details= { ... },
@details_key=nil,
@prefixes=[],
@rendered_format=nil,
@skip_default_locale=false,
@view_paths= #<ActionView::PathSet:0x007ff7250a0fe0 ...
delegate :formats, :formats=, :locale, :locale=, :view_paths, :view_paths=,
:to => :lookup_context
✗ ls
Gemfile README.rdoc app blorgh config.ru lib public tmp
Gemfile.lock Rakefile bin config db log test vendor
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), '../fixtures')
# => "./fixtures"
require 'action_view'
# => true
# 仍然只包含 7 项内容
lookup_context = ActionView::LookupContext.new(FIXTURE_LOAD_PATH, {})
=> #<ActionView::LookupContext:0x007ff725058088
@cache=true,
@details= { ... },
@details_key=nil,
@prefixes=[],
@rendered_format=nil,
@skip_default_locale=false,
@view_paths= #<ActionView::PathSet:0x007ff7250a0fe0 ...
attr_accessor :prefixes, :rendered_format
mattr_accessor :fallbacks
mattr_accessor :registered_details
formats=
skip_default_locale!
locale
locale=
with_layout_format
# 默认已经注册有:locale、formats、variants 和 handlers.
register_detail(:locale) { ... }
register_detail(:formats) { ... }
register_detail(:variants) { ... }
register_detail(:handlers) { ... }