Class: FileIO

Inherits:
Object
  • Object
show all
Defined in:
lib/file_io.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ FileIO



6
7
8
# File 'lib/file_io.rb', line 6

def initialize(file)
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



5
6
7
# File 'lib/file_io.rb', line 5

def file
  @file
end

Instance Method Details

#file_getterObject



14
15
16
# File 'lib/file_io.rb', line 14

def file_getter
  return @file
end

#uploadObject



9
10
11
12
13
# File 'lib/file_io.rb', line 9

def upload
  c = RestClient.post('https://file.io', :file => File.new(@file, "rb"))
  parse = JSON.parse(c)
  puts "Uploaded #{@file} to https://file.io/" << parse["key"]
end