Class: Imgur::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/imgur/models/image.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Imgur::Base

Instance Method Details

#url(size = nil) ⇒ Object

Provides the download URL in case you know a valid imgur hash and don’t want to make a network trip with .find Just in case you don’t need the full Imgur::Image object



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

def url(size = nil)
  size = case size
         when :small_square
           's'
         when :large_thumbnail
           'l'
         end

  splitted_link = link.split('.')

  splitted_link.insert(splitted_link.size - 1, size).join
end