Sha256: d3b6848e807d056b338f8d9fb74e614a05c8c2dd4cfae97614779470efe22627

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

module MasterView
  module Directives

    #creates a link_to
    class Javascript_include < MasterView::DirectiveBase
      JAVASCRIPT_SRC_EXTRACT_REGEX = /public\/javascripts\/(.*)/

      def stag(dcs)
      end

      def etag(dcs)
        src = attrs_lck['src']
        if attr_value.empty? && src
          match = JAVASCRIPT_SRC_EXTRACT_REGEX.match(src)
          js_loc = quote( (match) ? match[1] : src )
        else
          js_loc = attr_value.starts_with?(':') ? attr_value : quote(attr_value) 
        end
        erb_content('javascript_include_tag ' + js_loc)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
masterview-0.2.1 lib/masterview/directives/javascript_include.rb
masterview-0.2.2 lib/masterview/directives/javascript_include.rb