Module: Grackle::Utils

Defined in:
lib/grackle/utils.rb

Constant Summary collapse

VALID_PROFILE_IMAGE_SIZES =
[:bigger,:normal,:mini]

Class Method Summary collapse

Class Method Details

.profile_image_url(url, size = :normal) ⇒ Object

Easy method for getting different sized profile images using Twitter's naming scheme


7
8
9
10
11
# File 'lib/grackle/utils.rb', line 7

def profile_image_url(url,size=:normal)
  size = VALID_PROFILE_IMAGE_SIZES.find(:normal){|s| s == size.to_sym}
  return url if url.nil? || size == :normal
  url.sub(/_normal\./,"_#{size.to_s}.")
end