Class: Assets::Repository::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/assets/repository.rb

Overview

Physical directory repository

Instance Method Summary collapse

Instance Method Details

#compile(name) ⇒ Rule::Compile::Sass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build a compile rule

Returns:

  • (Rule::Compile::Sass)


55
56
57
# File 'lib/assets/repository.rb', line 55

def compile(name)
  Rule::Compile.build(file(name))
end

#file(name) ⇒ Rule::File

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build a file rule

Parameters:

  • name (#to_s)

Returns:



18
19
20
# File 'lib/assets/repository.rb', line 18

def file(name)
  Rule::File.new(name.to_s, path(name))
end

#glob(pattern) ⇒ Enumerable<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return names matching pattern

Parameters:

  • pattern (String)

Returns:

  • (Enumerable<String>)


30
31
32
33
34
35
# File 'lib/assets/repository.rb', line 30

def glob(pattern)
  root = self.root
  Pathname.glob(root.join(pattern)).map do |match|
    match.relative_path_from(root).to_s
  end
end

#path(name) ⇒ Pathname

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return path for name

Parameters:

  • name (String)

Returns:

  • (Pathname)


45
46
47
# File 'lib/assets/repository.rb', line 45

def path(name)
  root.join(name)
end