Sha256: 30f7d4a87cf22495ed1a9e45f501eebee6ebe3b2e75b59e14fba55e51a381f22

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 Bytes

Contents

$:.unshift File.expand_path(File.dirname(__FILE__))
require 'avatar/source/abstract_source'
require 'avatar/source/gravatar_source'

# Helpers for displaying avatars.
# Usage in Rails:
#   # in app/helpers/ProfileHelper.rb:
#   include Avatar::ActionView::Support
#
#   # in app/views/profiles/show.html.erb:
#   <%= avatar_for @person => current_person %>
#
# By default, Avatar::source is a GravatarSource
module Avatar
  
  @@source = Avatar::Source::GravatarSource.new
  @@default_avatar_options = {}
  
  def self.source
    @@source.dup
  end
  
  def self.source=(source)
    raise ArgumentError.new("#{source} is not an Avatar::Source::AbstractSource") unless source.kind_of?(Avatar::Source::AbstractSource)
    @@source = source
  end
  
  def self.default_avatar_options
    @@default_avatar_options.dup
  end
  
  def self.default_avatar_options=(options)
    raise ArgumentError.new("#{options} is not a Hash") unless options.kind_of?(Hash)
    @@options = options
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
gcnovus-avatar-0.0.7 lib/avatar.rb
avatar-0.0.5 lib/avatar.rb