Class: ChefAPI::Multipart::FilePart
- Inherits:
-
Object
- Object
- ChefAPI::Multipart::FilePart
- Defined in:
- lib/chef-api/connection.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.
625 626 627 628 629 |
# File 'lib/chef-api/connection.rb', line 625 def initialize(name, file) @file = file @head = build(name, file) @foot = "\r\n" end |
Instance Method Details
#io ⇒ Object
631 632 633 634 635 636 637 |
# File 'lib/chef-api/connection.rb', line 631 def io @io ||= MultiIO.new( StringIO.new(@head), @file, StringIO.new(@foot) ) end |
#size ⇒ Object
639 640 641 |
# File 'lib/chef-api/connection.rb', line 639 def size @head.bytesize + @file.size + @foot.bytesize end |