Class: Sprockets::Preprocessor
- Inherits:
-
Object
- Object
- Sprockets::Preprocessor
- Defined in:
- lib/sprockets/preprocessor.rb
Instance Attribute Summary collapse
-
#asset_paths ⇒ Object
readonly
Returns the value of attribute asset_paths.
-
#concatenation ⇒ Object
readonly
Returns the value of attribute concatenation.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#source_files ⇒ Object
readonly
Returns the value of attribute source_files.
Instance Method Summary collapse
-
#initialize(environment, options = {}) ⇒ Preprocessor
constructor
A new instance of Preprocessor.
- #provide(asset_path) ⇒ Object
- #require(source_file) ⇒ Object
Constructor Details
#initialize(environment, options = {}) ⇒ Preprocessor
Returns a new instance of Preprocessor.
5 6 7 8 9 10 11 |
# File 'lib/sprockets/preprocessor.rb', line 5 def initialize(environment, = {}) @environment = environment @concatenation = Concatenation.new @source_files = [] @asset_paths = [] @options = end |
Instance Attribute Details
#asset_paths ⇒ Object (readonly)
Returns the value of attribute asset_paths.
3 4 5 |
# File 'lib/sprockets/preprocessor.rb', line 3 def asset_paths @asset_paths end |
#concatenation ⇒ Object (readonly)
Returns the value of attribute concatenation.
3 4 5 |
# File 'lib/sprockets/preprocessor.rb', line 3 def concatenation @concatenation end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
3 4 5 |
# File 'lib/sprockets/preprocessor.rb', line 3 def environment @environment end |
#source_files ⇒ Object (readonly)
Returns the value of attribute source_files.
3 4 5 |
# File 'lib/sprockets/preprocessor.rb', line 3 def source_files @source_files end |
Instance Method Details
#provide(asset_path) ⇒ Object
28 29 30 31 |
# File 'lib/sprockets/preprocessor.rb', line 28 def provide(asset_path) return if !asset_path || asset_paths.include?(asset_path) asset_paths << asset_path end |
#require(source_file) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sprockets/preprocessor.rb', line 13 def require(source_file) return if source_files.include?(source_file) source_files << source_file source_file.each_source_line do |source_line| if source_line.require? require_from_source_line(source_line) elsif source_line.provide? provide_from_source_line(source_line) else record_source_line(source_line) end end end |