Class: ZAssets::MemoryFile
- Inherits:
-
Object
- Object
- ZAssets::MemoryFile
- Defined in:
- lib/zassets/memory_file.rb
Instance Method Summary collapse
- #body ⇒ Object
- #call(_env) ⇒ Object
- #headers ⇒ Object
-
#initialize(file) ⇒ MemoryFile
constructor
A new instance of MemoryFile.
Constructor Details
#initialize(file) ⇒ MemoryFile
Returns a new instance of MemoryFile.
3 4 5 |
# File 'lib/zassets/memory_file.rb', line 3 def initialize file @file = file end |
Instance Method Details
#body ⇒ Object
14 15 16 |
# File 'lib/zassets/memory_file.rb', line 14 def body @content ||= @file.read end |
#call(_env) ⇒ Object
18 19 20 |
# File 'lib/zassets/memory_file.rb', line 18 def call _env [200, headers, [body]] end |
#headers ⇒ Object
7 8 9 10 11 12 |
# File 'lib/zassets/memory_file.rb', line 7 def headers { 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s } end |