152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
# File 'lib/mls.rb', line 152
def avatar_url(options={})
return nil unless avatar_hash_key
options.reverse_merge!({
:style => nil,
:bg => nil,
:protocol => 'https',
:format => "jpg",
:host => MLS.image_host
});
url_params = { s: options[:style], bg: options[:bg] }.select{ |k, v| v }
if options[:protocol] == :relative result = '//'
else options[:protocol]
result = "#{options[:protocol]}://"
end
result += "#{options[:host]}/#{avatar_hash_key}.#{options[:format]}"
result += "?#{url_params.to_param}" if url_params.size > 0
result
end
|