Sha256: e90750774a4f111c895da6571bcc70b9d1fe6466a8a4a8761c6cd557f73e5e7e

Contents?: true

Size: 697 Bytes

Versions: 6

Compression:

Stored size: 697 Bytes

Contents

module Compressible::ViewHelpers
  
  def compressible_stylesheet_tag(*keys)
    Compressible.stylesheets_for(*keys).collect do |asset|
      stylesheet_link_tag(asset)
    end.join("\n").send(safe_method)
  end
  
  def compressible_javascript_tag(*keys)
    Compressible.javascripts_for(*keys).collect do |asset|
      javascript_include_tag(asset)
    end.join("\n").send(safe_method)
  end
  
  private
    def safe_method
      if "".respond_to?(:html_safe)
        return :html_safe
      elsif "".respond_to?(:html_safe!)
        return :html_safe!
      else
        return :to_s
      end
    end
  
end

ActionView::Base.send(:include, Compressible::ViewHelpers) if defined?(ActionView)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
compressible-0.0.3 lib/compressible/view_helpers.rb
compressible-0.0.2.6 lib/compressible/view_helpers.rb
compressible-0.0.2.4 lib/compressible/view_helpers.rb
compressible-0.0.2.3 lib/compressible/view_helpers.rb
compressible-0.0.2.2 lib/compressible/view_helpers.rb
compressible-0.0.2.1 lib/compressible/view_helpers.rb