Class: ActionView::Helpers::AssetTagHelper::AssetIncludeTag
- Includes:
- TagHelper
- Defined in:
- actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
Direct Known Subclasses
Constant Summary
Constants included from TagHelper
Instance Attribute Summary collapse
-
#asset_paths ⇒ Object
readonly
Returns the value of attribute asset_paths.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #asset_name ⇒ Object
- #asset_tag(source, options) ⇒ Object
- #custom_dir ⇒ Object
- #extension ⇒ Object
- #include_tag(*sources) ⇒ Object
-
#initialize(config, asset_paths) ⇒ AssetIncludeTag
constructor
A new instance of AssetIncludeTag.
Methods included from TagHelper
#cdata_section, #content_tag, #escape_once, #tag
Methods included from ActiveSupport::Concern
#append_features, extended, #included
Methods included from CaptureHelper
#capture, #content_for, #content_for?, #flush_output_buffer, #provide, #with_output_buffer
Constructor Details
#initialize(config, asset_paths) ⇒ AssetIncludeTag
Returns a new instance of AssetIncludeTag.
20 21 22 23 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 20 def initialize(config, asset_paths) @config = config @asset_paths = asset_paths end |
Instance Attribute Details
#asset_paths ⇒ Object (readonly)
Returns the value of attribute asset_paths
13 14 15 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 13 def asset_paths @asset_paths end |
#config ⇒ Object (readonly)
Returns the value of attribute config
13 14 15 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 13 def config @config end |
Class Method Details
.inherited(base) ⇒ Object
16 17 18 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 16 def self.inherited(base) base.expansions = { } end |
Instance Method Details
#asset_name ⇒ Object
25 26 27 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 25 def asset_name raise NotImplementedError end |
#asset_tag(source, options) ⇒ Object
37 38 39 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 37 def asset_tag(source, ) raise NotImplementedError end |
#custom_dir ⇒ Object
33 34 35 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 33 def custom_dir raise NotImplementedError end |
#extension ⇒ Object
29 30 31 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 29 def extension raise NotImplementedError end |
#include_tag(*sources) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb', line 41 def include_tag(*sources) = sources..stringify_keys concat = .delete("concat") cache = concat || .delete("cache") recursive = .delete("recursive") if concat || (config.perform_caching && cache) joined_name = (cache == true ? "all" : cache) + ".#{extension}" joined_path = File.join((joined_name[/^#{File::SEPARATOR}/] ? config.assets_dir : custom_dir), joined_name) unless config.perform_caching && File.exists?(joined_path) write_asset_file_contents(joined_path, compute_paths(sources, recursive)) end asset_tag(joined_name, ) else sources = (sources, recursive) ensure_sources!(sources) if cache sources.collect { |source| asset_tag(source, ) }.join("\n").html_safe end end |