Class: Rack::SmartCompress::Static::FileBody

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/smart_compress/static.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (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

#eachObject



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_pathObject



31
32
33
# File 'lib/rack/smart_compress/static.rb', line 31

def to_path
  @path
end