Class: Rack::Files::BaseIterator
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#ranges ⇒ Object
readonly
Returns the value of attribute ranges.
Instance Method Summary collapse
- #bytesize ⇒ Object
- #close ⇒ Object
- #each ⇒ Object
-
#initialize(path, ranges, options) ⇒ BaseIterator
constructor
A new instance of BaseIterator.
Constructor Details
#initialize(path, ranges, options) ⇒ BaseIterator
Returns a new instance of BaseIterator.
126 127 128 129 130 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb', line 126 def initialize(path, ranges, ) @path = path @ranges = ranges @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
124 125 126 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb', line 124 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
124 125 126 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb', line 124 def path @path end |
#ranges ⇒ Object (readonly)
Returns the value of attribute ranges.
124 125 126 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb', line 124 def ranges @ranges end |
Instance Method Details
#bytesize ⇒ Object
146 147 148 149 150 151 152 153 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb', line 146 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 |
#close ⇒ Object
155 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb', line 155 def close; end |
#each ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/files.rb', line 132 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 |