Class: Upload::Image

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Image

Returns a new instance of Image.



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

def initialize(path)
  @path = File.expand_path path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/upload/image.rb', line 3

def path
  @path
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/upload/image.rb', line 9

def exist?
  !!File.file?(path)
end

#fileObject



13
14
15
# File 'lib/upload/image.rb', line 13

def file
  File.new(@path, "rb")
end