Implements pavatar.com/spec/
Discovers pavatar URL. Returns nil if person is nil.
Options:
:pavatar_field (Symbol)
- the field to call from person. By
default, :blog_url
.
# File lib/avatar/source/pavatar_source.rb, line 28 def avatar_url_for(person, options = {}) return nil if person.nil? options = options.merge! ::Avatar.default_avatar_options field = options.delete(:pavatar_field) || :blog_url raise ArgumentError.new('No field specified; either specify a default field or pass in a value for :pavatar_field (probably :blog_url)') unless field pavatar_url = autodiscover_pavatar_url_from person.send(field) (pavatar_url.nil? || pavatar_url.to_s.blank?) ? nil : pavatar_url end
Create a new PAvatar source.
Options:
:http_connection_factory
- the Object used to start new HTTP connections. By
default,
the <code>Net::HTTP</code> class. To use a proxy, pass <code>:http_connection_factory => Net::HTTP::Proxy(...)</code>
# File lib/avatar/source/pavatar_source.rb, line 20 def initialize(options = {}) self.http_connection_factory = options.delete(:http_connection_factory) || Net::HTTP end