Sha256: 9d37ab1f45234b5d5e51a06b0534b78b92be7a09b6efb47776354059943afc79

Contents?: true

Size: 536 Bytes

Versions: 8

Compression:

Stored size: 536 Bytes

Contents

require 'action_view/helpers' if defined?(Rails)
require 'action_view/context' if defined?(Rails)

module InlineSvg
  module ActionView
    module Helpers
      def inline_svg(filename, transform_params={})
        begin
          svg_file = AssetFile.named(filename)
        rescue InlineSvg::AssetFile::FileNotFound
          return "<svg><!-- SVG file not found: '#{filename}' --></svg>".html_safe
        end

        InlineSvg::TransformPipeline.generate_html_from(svg_file, transform_params).html_safe
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
inline_svg-0.6.2 lib/inline_svg/action_view/helpers.rb
inline_svg-0.6.1 lib/inline_svg/action_view/helpers.rb
inline_svg-0.6.0 lib/inline_svg/action_view/helpers.rb
inline_svg-0.5.3 lib/inline_svg/action_view/helpers.rb
inline_svg-0.5.2 lib/inline_svg/action_view/helpers.rb
inline_svg-0.5.1 lib/inline_svg/action_view/helpers.rb
inline_svg-0.5.0 lib/inline_svg/action_view/helpers.rb
inline_svg-0.4.0 lib/inline_svg/action_view/helpers.rb