class Avatar::Source::StaticUrlSource

Source representing a constant URL. Good as a default or last-resort source.

Attributes

url[RW]

Public Instance Methods

avatar_url_for(person, options = {}) click to toggle source

Returns nil if person is nil; the static url otherwise.

# File lib/avatar/source/static_url_source.rb, line 19
def avatar_url_for(person, options = {})
  person.nil? ? nil : url
end

Public Class Methods

new(url) click to toggle source

Create a new source with static url url.

# File lib/avatar/source/static_url_source.rb, line 13
def initialize(url)
  raise ArgumentError.new("URL cannot be nil") if url.nil?
  @url = url.to_s
end