mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
[skip ci] Lookup can be a noun but it is not a verb
Various grammar corrections and wrap to 80 characters.
This commit is contained in:
parent
2c79122c0b
commit
ea747f7d2e
7 changed files with 17 additions and 14 deletions
|
@ -183,7 +183,8 @@
|
||||||
*arthurnn*
|
*arthurnn*
|
||||||
|
|
||||||
* `ActionController#translate` supports symbols as shortcuts.
|
* `ActionController#translate` supports symbols as shortcuts.
|
||||||
When shortcut is given it also lookups without action name.
|
When a shortcut is given it also performs the lookup without the action
|
||||||
|
name.
|
||||||
|
|
||||||
*Max Melentiev*
|
*Max Melentiev*
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ module ActionView
|
||||||
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
|
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
|
||||||
#
|
#
|
||||||
# With the <tt>scope</tt> option, you can define a custom scope for Rails
|
# With the <tt>scope</tt> option, you can define a custom scope for Rails
|
||||||
# to lookup the translation.
|
# to look up the translation.
|
||||||
#
|
#
|
||||||
# For example you can define the following in your locale (e.g. en.yml).
|
# For example you can define the following in your locale (e.g. en.yml).
|
||||||
#
|
#
|
||||||
|
|
|
@ -6,10 +6,11 @@ require 'action_view/template/resolver'
|
||||||
module ActionView
|
module ActionView
|
||||||
# = Action View Lookup Context
|
# = Action View Lookup Context
|
||||||
#
|
#
|
||||||
# <tt>LookupContext</tt> is the object responsible to hold all information required to lookup
|
# <tt>LookupContext</tt> is the object responsible for holding all information
|
||||||
# templates, i.e. view paths and details. The LookupContext is also responsible to
|
# required for looking up templates, i.e. view paths and details.
|
||||||
# generate a key, given to view paths, used in the resolver cache lookup. Since
|
# <tt>LookupContext</tt> is also responsible for generating a key, given to
|
||||||
# this key is generated just once during the request, it speeds up all cache accesses.
|
# view paths, used in the resolver cache lookup. Since this key is generated
|
||||||
|
# only once during the request, it speeds up all cache accesses.
|
||||||
class LookupContext #:nodoc:
|
class LookupContext #:nodoc:
|
||||||
attr_accessor :prefixes, :rendered_format
|
attr_accessor :prefixes, :rendered_format
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ module ActionView
|
||||||
view_renderer.render(context, options)
|
view_renderer.render(context, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Assign the rendered format to lookup context.
|
# Assign the rendered format to look up context.
|
||||||
def _process_format(format, options = {}) #:nodoc:
|
def _process_format(format, options = {}) #:nodoc:
|
||||||
super
|
super
|
||||||
lookup_context.formats = [format.to_sym]
|
lookup_context.formats = [format.to_sym]
|
||||||
|
|
|
@ -36,9 +36,9 @@ module ActionView
|
||||||
self.class._prefixes
|
self.class._prefixes
|
||||||
end
|
end
|
||||||
|
|
||||||
# <tt>LookupContext</tt> is the object responsible to hold all information required to lookup
|
# <tt>LookupContext</tt> is the object responsible for holding all
|
||||||
# templates, i.e. view paths and details. Check <tt>ActionView::LookupContext</tt> for more
|
# information required for looking up templates, i.e. view paths and
|
||||||
# information.
|
# details. Check <tt>ActionView::LookupContext</tt> for more information.
|
||||||
def lookup_context
|
def lookup_context
|
||||||
@_lookup_context ||=
|
@_lookup_context ||=
|
||||||
ActionView::LookupContext.new(self.class._view_paths, details_for_lookup, _prefixes)
|
ActionView::LookupContext.new(self.class._view_paths, details_for_lookup, _prefixes)
|
||||||
|
|
|
@ -65,7 +65,8 @@ class Time
|
||||||
if !time_zone || time_zone.is_a?(ActiveSupport::TimeZone)
|
if !time_zone || time_zone.is_a?(ActiveSupport::TimeZone)
|
||||||
time_zone
|
time_zone
|
||||||
else
|
else
|
||||||
# lookup timezone based on identifier (unless we've been passed a TZInfo::Timezone)
|
# Look up the timezone based on the identifier (unless we've been
|
||||||
|
# passed a TZInfo::Timezone)
|
||||||
unless time_zone.respond_to?(:period_for_local)
|
unless time_zone.respond_to?(:period_for_local)
|
||||||
time_zone = ActiveSupport::TimeZone[time_zone] || TZInfo::Timezone.get(time_zone)
|
time_zone = ActiveSupport::TimeZone[time_zone] || TZInfo::Timezone.get(time_zone)
|
||||||
end
|
end
|
||||||
|
|
|
@ -103,12 +103,12 @@ module Rails
|
||||||
# hook_for :test_framework, as: :controller
|
# hook_for :test_framework, as: :controller
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# And now it will lookup at:
|
# And now it will look up at:
|
||||||
#
|
#
|
||||||
# "test_unit:controller", "test_unit"
|
# "test_unit:controller", "test_unit"
|
||||||
#
|
#
|
||||||
# Similarly, if you want it to also lookup in the rails namespace, you just
|
# Similarly, if you want it to also look up in the rails namespace, you
|
||||||
# need to provide the :in value:
|
# just need to provide the :in value:
|
||||||
#
|
#
|
||||||
# class AwesomeGenerator < Rails::Generators::Base
|
# class AwesomeGenerator < Rails::Generators::Base
|
||||||
# hook_for :test_framework, in: :rails, as: :controller
|
# hook_for :test_framework, in: :rails, as: :controller
|
||||||
|
|
Loading…
Reference in a new issue