class Rack::Files::BaseIterator
Атрибуты
Общедоступные методы класса
# File lib/rack/files.rb, line 142 def initialize(path, ranges, options) @path = path @ranges = ranges @options = options end
Общедоступные методы экземпляра
# File lib/rack/files.rb, line 162
def bytesize
size = ranges.inject(0) do |sum, range|
sum += multipart_heading(range).bytesize if multipart?
sum += range.size
end
size += "\r\n--#{MULTIPART_BOUNDARY}--\r\n".bytesize if multipart?
size
end # File lib/rack/files.rb, line 171 def close; end
# File lib/rack/files.rb, line 148
def each
::File.open(path, "rb") do |file|
ranges.each do |range|
yield multipart_heading(range) if multipart?
each_range_part(file, range) do |part|
yield part
end
end
yield "\r\n--#{MULTIPART_BOUNDARY}--\r\n" if multipart?
end
end
© 2007-2021 Leah Neukirchen
Licensed under the MIT License.