Sha256: cfba624ae86d137c7f6bf10c6b587e448e3e03b35917e99a84c3035a3c11d8d0

Contents?: true

Size: 657 Bytes

Versions: 9

Compression:

Stored size: 657 Bytes

Contents

module SocialAvatarProxy
  module PathHelpers
    def avatar_base_path
      @avatar_base_path ||= ""
    end
    
    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
    
    def twitter_avatar_path(identifier)
      File.join(avatar_base_path, "twitter", identifier.to_s)
    end
    
    def facebook_avatar_path(identifier)
      File.join(avatar_base_path, "facebook", identifier.to_s)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
social-avatar-proxy-2.0.1 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-2.0.0 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-1.2.0 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-1.1.0 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-1.0.1 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-1.0.0 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-0.0.9 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-0.0.8 lib/social_avatar_proxy/path_helpers.rb
social-avatar-proxy-0.0.7 lib/social_avatar_proxy/path_helpers.rb