Class: ChefAPI::Multipart::FilePart

Inherits:
Object
  • Object
show all
Defined in:
lib/chef-api/connection.rb

Overview

A File part

Instance Method Summary collapse

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

#ioObject



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

#sizeObject



639
640
641
# File 'lib/chef-api/connection.rb', line 639

def size
  @head.bytesize + @file.size + @foot.bytesize
end