Class: Sprockets::Concatenation
- Inherits:
-
Object
- Object
- Sprockets::Concatenation
- Defined in:
- lib/sprockets/concatenation.rb
Instance Attribute Summary collapse
-
#source_lines ⇒ Object
readonly
Returns the value of attribute source_lines.
Instance Method Summary collapse
-
#initialize ⇒ Concatenation
constructor
A new instance of Concatenation.
- #mtime ⇒ Object
- #record(source_line) ⇒ Object
- #save_to(filename) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Concatenation
Returns a new instance of Concatenation.
5 6 7 8 |
# File 'lib/sprockets/concatenation.rb', line 5 def initialize @source_lines = [] @source_file_mtimes = {} end |
Instance Attribute Details
#source_lines ⇒ Object (readonly)
Returns the value of attribute source_lines.
3 4 5 |
# File 'lib/sprockets/concatenation.rb', line 3 def source_lines @source_lines end |
Instance Method Details
#mtime ⇒ Object
20 21 22 |
# File 'lib/sprockets/concatenation.rb', line 20 def mtime @source_file_mtimes.values.max end |
#record(source_line) ⇒ Object
10 11 12 13 14 |
# File 'lib/sprockets/concatenation.rb', line 10 def record(source_line) source_lines << source_line record_mtime_for(source_line.source_file) source_line end |
#save_to(filename) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/sprockets/concatenation.rb', line 24 def save_to(filename) = mtime File.open(filename, "w") { |file| file.write(to_s) } File.utime(, , filename) true end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/sprockets/concatenation.rb', line 16 def to_s source_lines.join end |