Class: CatchNotes::Image

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Image

Returns a new instance of Image.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/catch_notes/image.rb', line 6

def initialize(opts = {})
  @attr = opts
  @url = nil
  @data = nil
  if opts[:url]
    init_from_url
  elsif opts[:file]
    init_from_file
  elsif opts[:data]
    init_from_data
  end
end

Instance Attribute Details

#dataObject

Returns the raw data of the image. If there is no data, it will be generated from the image at url if it is set.



33
34
35
# File 'lib/catch_notes/image.rb', line 33

def data
  @data
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/catch_notes/image.rb', line 4

def url
  @url
end

Instance Method Details

#destroyObject

:nodoc:



61
62
63
64
65
# File 'lib/catch_notes/image.rb', line 61

def destroy #:nodoc:
  destroy!
rescue
  false
end

#destroy!Object

:nodoc:



58
59
# File 'lib/catch_notes/image.rb', line 58

def destroy! #:nodoc:
end