Class: Rail::Precompiler::Storage
- Inherits:
-
Object
- Object
- Rail::Precompiler::Storage
- Defined in:
- lib/rail/precompiler.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root = 'public') ⇒ Storage
constructor
A new instance of Storage.
- #write(file, stream) ⇒ Object
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
4 5 6 |
# File 'lib/rail/precompiler.rb', line 4 def root @root end |
Instance Method Details
#write(file, stream) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rail/precompiler.rb', line 10 def write(file, stream) file = File.join(root, file) unless File.exist?(File.dirname(file)) FileUtils.mkdir_p(File.dirname(file)) end File.open(file, 'w') do |file| stream.each { |chunk| file.write(chunk) } end end |