module Net::SCP::Upload

def upload_current_state(channel)

to #upload_directory_state.
item is a file, goes to #upload_file_state. If it is a directory, goes
Determines what the next thing to upload is, and branches. If the next
def upload_current_state(channel)
  if channel[:current].respond_to?(:read)
    upload_file_state(channel)
  elsif File.directory?(channel[:current])
    raise Net::SCP::Error, "can't upload directories unless :recursive" unless channel[:options][:recursive]
    upload_directory_state(channel)
  elsif File.file?(channel[:current])
    upload_file_state(channel)
  else
    raise Net::SCP::Error, "not a directory or a regular file: #{channel[:current].inspect}"
  end
end