class ActionView::Helpers::AssetTagHelper::AssetIncludeTag - actionpack-3.2.22 Documentation

# class ActionView::Helpers::AssetTagHelper::AssetIncludeTag

### Attributes

asset_paths[R]
config[R]

### Public Class Methods

inherited(base) click to toggle source

    # File lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb, line 16
    def self.inherited(base)
      base.expansions = { }
    end

new(config, asset_paths) click to toggle source

    # File 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

### Public Instance Methods

asset_name() click to toggle source

    # File lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb, line 25
    def asset_name
      raise NotImplementedError
    end

asset_tag(source, options) click to toggle source

    # File lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb, line 37
    def asset_tag(source, options)
      raise NotImplementedError
    end

custom_dir() click to toggle source

    # File lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb, line 33
    def custom_dir
      raise NotImplementedError
    end

extension() click to toggle source

    # File lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb, line 29
    def extension
      raise NotImplementedError
    end

include_tag(*sources) click to toggle source

    # File lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb, line 41
    def include_tag(*sources)
      options = sources.extract_options!.stringify_keys
      concat  = options.delete("concat")
      cache   = concat || options.delete("cache")
      recursive = options.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, options)
      else
        sources = expand_sources(sources, recursive)
        ensure_sources!(sources) if cache
        sources.collect { |source| asset_tag(source, options) }.join("\n").html_safe
      end
    end