Class: ChefAPI::Multipart::FilePart
- Inherits:
-
Object
- Object
- ChefAPI::Multipart::FilePart
- Defined in:
- lib/chef-api/multipart.rb
Overview
A File part
Instance Method Summary collapse
-
#initialize(name, file) ⇒ FilePart
constructor
A new instance of FilePart.
- #io ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(name, file) ⇒ FilePart
Returns a new instance of FilePart.
113 114 115 116 117 |
# File 'lib/chef-api/multipart.rb', line 113 def initialize(name, file) @file = file @head = build(name, file) @foot = "\r\n" end |
Instance Method Details
#io ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/chef-api/multipart.rb', line 119 def io @io ||= MultiIO.new( StringIO.new(@head), @file, StringIO.new(@foot) ) end |
#size ⇒ Object
127 128 129 |
# File 'lib/chef-api/multipart.rb', line 127 def size @head.bytesize + @file.size + @foot.bytesize end |