aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2016-06-15 12:21:19 -0500
committerschneems <richard.schneeman@gmail.com>2016-08-29 13:16:07 -0500
commitb8905f3c85e0bdd96c01ca181eda91705db0bc74 (patch)
treeba4dc93f0813dfac6348af1fa74a33916bb6406c /actionview
parente4b233a2523960b604d8829a5a23d329fba52d23 (diff)
downloadrails-b8905f3c85e0bdd96c01ca181eda91705db0bc74.tar.gz
rails-b8905f3c85e0bdd96c01ca181eda91705db0bc74.tar.bz2
rails-b8905f3c85e0bdd96c01ca181eda91705db0bc74.zip
Add docs to `public_*_path` methods & fix comments
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/helpers/asset_url_helper.rb51
1 files changed, 36 insertions, 15 deletions
diff --git a/actionview/lib/action_view/helpers/asset_url_helper.rb b/actionview/lib/action_view/helpers/asset_url_helper.rb
index bd91ace5c8..844826386a 100644
--- a/actionview/lib/action_view/helpers/asset_url_helper.rb
+++ b/actionview/lib/action_view/helpers/asset_url_helper.rb
@@ -168,10 +168,13 @@ module ActionView
alias_method :path_to_asset, :asset_path # aliased to avoid conflicts with an asset_path named route
+ # Computes the path to an asset in the public folder.
+ # This uses +asset_path+ and skips any asset lookups by assuming the asset is in the
+ # `public` folder.
def public_asset_path(source, options = {})
path_to_asset(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_asset, :public_asset_path # aliased to avoid conflicts with an font_path named route
+ alias_method :path_to_public_asset, :public_asset_path # aliased to avoid conflicts with an public_asset_path named route
# Computes the full URL to an asset in the public directory. This
# will use +asset_path+ internally, so most of their behaviors
@@ -188,13 +191,13 @@ module ActionView
end
alias_method :url_to_asset, :asset_url # aliased to avoid conflicts with an asset_url named route
- # Computes the full URL to a asset in the public folder.
+ # Computes the full URL to an asset in the public folder.
# This uses +asset_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_asset_url(source, options = {})
url_to_asset(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_asset, :public_asset_path # aliased to avoid conflicts with an asset_path named route
+ alias_method :path_to_public_asset, :public_asset_path # aliased to avoid conflicts with a public_asset_path named route
ASSET_EXTENSIONS = {
javascript: ".js",
@@ -282,10 +285,13 @@ module ActionView
end
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with a javascript_path named route
+ # Computes the path to a javascript asset in the public folder.
+ # This uses +javascript_path+ and skips any asset lookups by assuming the asset is in the
+ # `public` folder.
def public_javascript_path(source, options = {})
path_to_javascript(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_javascript, :public_javascript_path # aliased to avoid conflicts with an font_path named route
+ alias_method :path_to_public_javascript, :public_javascript_path # aliased to avoid conflicts with a public_javascript_path named route
# Computes the full URL to a JavaScript asset in the public javascripts directory.
# This will use +javascript_path+ internally, so most of their behaviors will be the same.
@@ -305,7 +311,7 @@ module ActionView
def public_javascript_url(source, options = {})
url_to_javascript(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_javascript, :public_javascript_path # aliased to avoid conflicts with an javascript_path named route
+ alias_method :path_to_public_javascript, :public_javascript_path # aliased to avoid conflicts with a public_javascript_path named route
# Computes the path to a stylesheet asset in the public stylesheets directory.
# If the +source+ filename has no extension, .css will be appended (except for explicit URIs).
@@ -322,10 +328,13 @@ module ActionView
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with a stylesheet_path named route
+ # Computes the path to a stylesheet asset in the public folder.
+ # This uses +stylesheet_path+ and skips any asset lookups by assuming the asset is in the
+ # `public` folder.
def public_stylesheet_path(source, options)
path_to_stylesheet(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_stylesheet, :public_stylesheet_path # aliased to avoid conflicts with an font_path named route
+ alias_method :path_to_public_stylesheet, :public_stylesheet_path # aliased to avoid conflicts with a public_stylesheet_path named route
# Computes the full URL to a stylesheet asset in the public stylesheets directory.
# This will use +stylesheet_path+ internally, so most of their behaviors will be the same.
@@ -345,7 +354,7 @@ module ActionView
def public_stylesheet_url(source, options = {})
url_to_stylesheet(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_stylesheet, :public_stylesheet_path # aliased to avoid conflicts with an stylesheet_path named route
+ alias_method :path_to_public_stylesheet, :public_stylesheet_path # aliased to avoid conflicts with a public_stylesheet_path named route
# Computes the path to an image asset.
# Full paths from the document root will be passed through.
@@ -365,10 +374,13 @@ module ActionView
end
alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
+ # Computes the path to a image asset in the public folder.
+ # This uses +image_path+ and skips any asset lookups by assuming the asset is in the
+ # `public` folder.
def public_image_path(source, options)
path_to_image(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_image, :public_image_path # aliased to avoid conflicts with an font_path named route
+ alias_method :path_to_public_image, :public_image_path # aliased to avoid conflicts with a public_image_path named route
# Computes the full URL to an image asset.
# This will use +image_path+ internally, so most of their behaviors will be the same.
@@ -388,7 +400,7 @@ module ActionView
def public_image_url(source, options = {})
url_to_image(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_image, :public_image_path # aliased to avoid conflicts with an image_path named route
+ alias_method :path_to_public_image, :public_image_path # aliased to avoid conflicts with a public_image_path named route
# Computes the path to a video asset in the public videos directory.
# Full paths from the document root will be passed through.
@@ -404,10 +416,13 @@ module ActionView
end
alias_method :path_to_video, :video_path # aliased to avoid conflicts with a video_path named route
+ # Computes the path to a video asset in the public folder.
+ # This uses +video_path+ and skips any asset lookups by assuming the asset is in the
+ # `public` folder.
def public_video_path(source, options)
path_to_video(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_video, :public_video_path # aliased to avoid conflicts with an font_path named route
+ alias_method :path_to_public_video, :public_video_path # aliased to avoid conflicts with a public_video_path named route
# Computes the full URL to a video asset in the public videos directory.
# This will use +video_path+ internally, so most of their behaviors will be the same.
@@ -427,7 +442,7 @@ module ActionView
def public_video_url(source, options = {})
url_to_video(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_video, :public_video_path # aliased to avoid conflicts with an video_path named route
+ alias_method :path_to_public_video, :public_video_path # aliased to avoid conflicts with a public_video_path named route
# Computes the path to an audio asset in the public audios directory.
# Full paths from the document root will be passed through.
@@ -443,10 +458,13 @@ module ActionView
end
alias_method :path_to_audio, :audio_path # aliased to avoid conflicts with an audio_path named route
+ # Computes the path to a audio asset in the public folder.
+ # This uses +audio_path+ and skips any asset lookups by assuming the asset is in the
+ # `public` folder.
def public_audio_path(source, options = {})
path_to_audio(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_audio, :public_audio_path # aliased to avoid conflicts with an font_path named route
+ alias_method :path_to_public_audio, :public_audio_path # aliased to avoid conflicts with a public_audio_path named route
# Computes the full URL to an audio asset in the public audios directory.
# This will use +audio_path+ internally, so most of their behaviors will be the same.
@@ -466,7 +484,7 @@ module ActionView
def public_audio_url(source, options = {})
url_to_audio(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_audio, :public_audio_path # aliased to avoid conflicts with an audio_path named route
+ alias_method :path_to_public_audio, :public_audio_path # aliased to avoid conflicts with a public_audio_path named route
# Computes the path to a font asset.
# Full paths from the document root will be passed through.
@@ -481,10 +499,13 @@ module ActionView
end
alias_method :path_to_font, :font_path # aliased to avoid conflicts with an font_path named route
+ # Computes the path to a font asset in the public folder.
+ # This uses +font_path+ and skips any asset lookups by assuming the asset is in the
+ # `public` folder.
def public_font_path(source, options = {})
path_to_font(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_font, :public_font_path # aliased to avoid conflicts with an font_path named route
+ alias_method :path_to_public_font, :public_font_path # aliased to avoid conflicts with a public_font_path named route
# Computes the full URL to a font asset.
# This will use +font_path+ internally, so most of their behaviors will be the same.
@@ -504,7 +525,7 @@ module ActionView
def public_font_url(source, options = {})
url_to_font(source, {public_folder: true}.merge!(options))
end
- alias_method :path_to_public_font, :public_font_path # aliased to avoid conflicts with an public_font_url named route
+ alias_method :path_to_public_font, :public_font_path # aliased to avoid conflicts with a public_font_url named route
end
end
end