Skip to content

Commit

Permalink
more duck typing
Browse files Browse the repository at this point in the history
  • Loading branch information
lwe committed Jun 10, 2012
1 parent b6ede9c commit 183a567
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/gravatarify/base.rb
Expand Up @@ -66,7 +66,7 @@ def gravatar_url(email, *params)
# for the same decicion.
# @return [String] Protocol and hostname (like <tt>http://www.gravatar.com</tt>), without trailing slash.
def self.gravatar_host(context, str_hash, secure = false)
use_ssl_host = secure.is_a?(Proc) ? secure.call(context) : secure
use_ssl_host = secure.respond_to?(:call) ? secure.call(context) : secure
use_ssl_host ? "https://secure.gravatar.com" : "http://#{Gravatarify.subdomain(str_hash)}gravatar.com"
end

Expand All @@ -75,7 +75,7 @@ def self.gravatar_params(source, url_options = {})
params = url_options.inject([]) do |params, (key, value)|
key = (GRAVATAR_ABBREV_OPTIONS[key] || key).to_sym # shorten & symbolize key
unless key == :html
value = value.call(url_options, source) if key == :d and value.is_a?(Proc)
value = value.call(url_options, source) if key == :d && value.respond_to?(:call)
params << "#{key}=#{CGI.escape(value.to_s)}" if value
end
params
Expand Down

0 comments on commit 183a567

Please sign in to comment.