Module: SocialAvatarProxy::PathHelpers

Included in:
Routes
Defined in:
lib/social_avatar_proxy/path_helpers.rb

Instance Method Summary collapse

Instance Method Details

#avatar_base_pathObject



3
4
5
# File 'lib/social_avatar_proxy/path_helpers.rb', line 3

def avatar_base_path
  @avatar_base_path ||= ""
end

#avatar_base_path=(path) ⇒ Object



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

def avatar_base_path=(path)
  # strip leading / trailing slashes
  path = path.gsub(/^\/|\/$/, "")
  if path.empty?
    # reset to an empty string
    @avatar_base_path = ""
  else
    # set with prepended slash
    @avatar_base_path = "/#{path}"
  end
end

#facebook_avatar_path(identifier) ⇒ Object



23
24
25
# File 'lib/social_avatar_proxy/path_helpers.rb', line 23

def facebook_avatar_path(identifier)
  File.join(avatar_base_path, "facebook", identifier.to_s)
end

#twitter_avatar_path(identifier) ⇒ Object



19
20
21
# File 'lib/social_avatar_proxy/path_helpers.rb', line 19

def twitter_avatar_path(identifier)
  File.join(avatar_base_path, "twitter", identifier.to_s)
end