Sha256: 378e16dc6f23551fd3c44e4a22ba815558bc44658d053f0623ad4464235f5bbd

Contents?: true

Size: 507 Bytes

Versions: 3

Compression:

Stored size: 507 Bytes

Contents

module Sprockets
  module Directives
    class ProvideDirective < Directive
      def self.pattern
        /(provide)\s+(#{QUOTED_STRING})/
      end
      
      def evaluate_in(preprocessor)
        if asset_path
          preprocessor.provide(asset_path)
        else
          raise_load_error
        end
      end

      def asset_path
        source_file.find(provide_location, :directory)
      end
      
      def provide_location
        parse_quoted_string(argument)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sprockets-foo-0.0.4 ext/sprockets_with_directives/lib/sprockets/directives/provide_directive.rb
sprockets-foo-0.0.3 ext/sprockets_with_directives/lib/sprockets/directives/provide_directive.rb
sprockets-foo-0.0.2 ext/sprockets_with_directives/lib/sprockets/directives/provide_directive.rb