Class: Rack::SmartCompress::Static::FileBody
- Inherits:
-
Object
- Object
- Rack::SmartCompress::Static::FileBody
- Defined in:
- lib/rack/smart_compress/static.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(path) ⇒ FileBody
constructor
A new instance of FileBody.
- #to_path ⇒ Object
Constructor Details
#initialize(path) ⇒ FileBody
Returns a new instance of FileBody.
19 20 21 |
# File 'lib/rack/smart_compress/static.rb', line 19 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
17 18 19 |
# File 'lib/rack/smart_compress/static.rb', line 17 def path @path end |
Instance Method Details
#each ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rack/smart_compress/static.rb', line 23 def each File.open(@path, "rb") do |file| while (chunk = file.read(16_384)) yield chunk end end end |
#to_path ⇒ Object
31 32 33 |
# File 'lib/rack/smart_compress/static.rb', line 31 def to_path @path end |