Class: Assets::Package::Builder

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ undefined

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.

Initialize object

Parameters:



52
53
54
55
# File 'lib/assets/package.rb', line 52

def initialize(repository)
  @repository = repository
  @contents = Hash.new { |hash, key| hash[key] = [] }
end

Instance Attribute Details

#contentsHash (readonly)

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 contents

Returns:

  • (Hash)


63
64
65
# File 'lib/assets/package.rb', line 63

def contents
  @contents
end

#repositoryRepository (readonly)

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 repository

Returns:



71
72
73
# File 'lib/assets/package.rb', line 71

def repository
  @repository
end

Class Method Details

.run(directory) {|builder| ... } ⇒ Package

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.

Run builder

Parameters:

  • directory (String)

Yields:

  • (builder)

Returns:



37
38
39
40
41
42
# File 'lib/assets/package.rb', line 37

def self.run(directory)
  repository = Repository::Directory.new(directory)
  builder = new(repository)
  yield builder
  Package.new(repository, builder.contents)
end

Instance Method Details

#append(rule) ⇒ self

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.

Append rule

Parameters:

Returns:

  • (self)


117
118
119
120
# File 'lib/assets/package.rb', line 117

def append(rule)
  @contents[rule.mime] << rule
  self
end

#compile(name) ⇒ self

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.

Add compile

Parameters:

  • name (String)

Returns:

  • (self)


81
82
83
# File 'lib/assets/package.rb', line 81

def compile(name)
  append(repository.compile(name))
end

#file(name) ⇒ self

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.

Add static file

Parameters:

  • name (String)

Returns:

  • (self)


93
94
95
# File 'lib/assets/package.rb', line 93

def file(name)
  append(repository.file(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.

Perform glob

Parameters:

  • pattern (String)

Returns:

  • (Enumerable<String>)


105
106
107
# File 'lib/assets/package.rb', line 105

def glob(pattern)
  repository.glob(pattern)
end