Sha256: 000f31de958410eb7555e233876bc53412c9da4c5a66e001fbdfa8a1e4bb892e

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

module Assets

  # Abstract base class for asset repositories
  class Repository

    # Physical directory repository
    class Directory
      include Concord.new(:root)

      # Build a file rule
      #
      # @param [#to_s] name
      #
      # @return [Rule::File]
      #
      # @api private
      #
      def file(name)
        Rule::File.new(name.to_s, path(name))
      end

      # Return names matching pattern 
      #
      # @param [String] pattern
      #
      # @return [Enumerable<String>]
      #
      # @api private
      #
      def glob(pattern)
        root = self.root
        Pathname.glob(root.join(pattern)).map do |match|
          match.relative_path_from(root).to_s
        end
      end

      # Return path for name
      #
      # @param [String] name
      #
      # @return [Pathname]
      #
      # @api private
      #
      def path(name)
        root.join(name)
      end

      # Build a compile rule
      #
      # @return [Rule::Compile::Sass]
      #
      # @api private
      #
      def compile(name)
        Rule::Compile.build(file(name))
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mbj-assets-0.0.11 lib/assets/repository.rb
mbj-assets-0.0.10 lib/assets/repository.rb
mbj-assets-0.0.9 lib/assets/repository.rb
mbj-assets-0.0.8 lib/assets/repository.rb
mbj-assets-0.0.7 lib/assets/repository.rb
mbj-assets-0.0.6 lib/assets/repository.rb
mbj-assets-0.0.5 lib/assets/repository.rb
mbj-assets-0.0.4 lib/assets/repository.rb
mbj-assets-0.0.3 lib/assets/repository.rb