Class: Assets::Package::Builder
- Inherits:
-
Object
- Object
- Assets::Package::Builder
- Defined in:
- lib/assets/package.rb
Instance Attribute Summary collapse
-
#contents ⇒ Hash
readonly
private
Return contents.
-
#repository ⇒ Repository
readonly
private
Return repository.
Class Method Summary collapse
-
.run(directory) {|builder| ... } ⇒ Package
private
Run builder.
Instance Method Summary collapse
-
#append(rule) ⇒ self
private
Append rule.
-
#compile(name) ⇒ self
private
Add compile.
-
#file(name) ⇒ self
private
Add static file.
-
#glob(pattern) ⇒ Enumerable<String>
private
Perform glob.
-
#initialize(repository) ⇒ undefined
constructor
private
Initialize object.
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
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
#contents ⇒ Hash (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
63 64 65 |
# File 'lib/assets/package.rb', line 63 def contents @contents end |
#repository ⇒ Repository (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
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
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
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
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
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
105 106 107 |
# File 'lib/assets/package.rb', line 105 def glob(pattern) repository.glob(pattern) end |