Class: Identiconify::Identicon
- Inherits:
-
Object
- Object
- Identiconify::Identicon
- Defined in:
- lib/identiconify.rb
Constant Summary collapse
- DEFAULT_HASH_PROVIDER =
->(string) { Digest::SHA1.hexdigest(string).to_i(16) }
Instance Method Summary collapse
-
#initialize(string, options = {}) ⇒ Identicon
constructor
A new instance of Identicon.
- #to_png_blob ⇒ Object
Constructor Details
#initialize(string, options = {}) ⇒ Identicon
Returns a new instance of Identicon.
11 12 13 14 15 16 |
# File 'lib/identiconify.rb', line 11 def initialize(string, ={}) @string = string @size = .fetch(:size) { 250 } @colors = .fetch(:colors) { :default }.to_sym @hash_provider = .fetch(:hash_provider) { DEFAULT_HASH_PROVIDER } end |
Instance Method Details
#to_png_blob ⇒ Object
18 19 20 |
# File 'lib/identiconify.rb', line 18 def to_png_blob render.to_blob :fast_rgba end |