Sha256: 5366520867191c6b1d68f1ae6a9745f538cefd8ac3022e0e12bb7890f1c3835d
Contents?: true
Size: 634 Bytes
Versions: 9
Compression:
Stored size: 634 Bytes
Contents
require 'avatar/source/abstract_source' module Avatar # :nodoc: module Source # :nodoc: # Source representing a constant URL. # Good as a default or last-resort source. class StaticUrlSource include AbstractSource attr_accessor :url # Create a new source with static url +url+. def initialize(url) raise ArgumentError.new("URL cannot be nil") if url.nil? @url = url.to_s end # Returns nil if person is nil; the static url otherwise. def avatar_url_for(person, options = {}) person.nil? ? nil : url end end end end
Version data entries
9 entries across 9 versions & 3 rubygems