Return nil if the #underlying_source
does; otherwise, calls wrap
, passing the returned URL and the
person and options passed.
# File lib/avatar/source/wrapper/abstract_source_wrapper.rb, line 19 def avatar_url_for(person, options = {}) url = @underlying_source.avatar_url_for(person, options) url.nil? ? nil : wrap(url, person, options) end
Apply appropriate wrapping of the url
returned by
underlying_source
. Will never be called with a nil
url
.
# File lib/avatar/source/wrapper/abstract_source_wrapper.rb, line 26 def wrap(url, person, options) raise NotImplementedError('subclasses must override wrap(url, person, options)') end
Create a new Wrapper
# File lib/avatar/source/wrapper/abstract_source_wrapper.rb, line 12 def initialize(underlying_source) raise ArgumentError.new("underlying_source must be Source") unless underlying_source.kind_of?(Avatar::Source::AbstractSource) @underlying_source = underlying_source end