Class: Upload::Image
- Inherits:
-
Object
- Object
- Upload::Image
- Defined in:
- lib/upload/image.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exist? ⇒ Boolean
- #file ⇒ Object
-
#initialize(path) ⇒ Image
constructor
A new instance of Image.
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. path end |
Instance Attribute Details
#path ⇒ Object (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
9 10 11 |
# File 'lib/upload/image.rb', line 9 def exist? !!File.file?(path) end |
#file ⇒ Object
13 14 15 |
# File 'lib/upload/image.rb', line 13 def file File.new(@path, "rb") end |