Class: Idecon::Identicon
- Inherits:
-
Object
- Object
- Idecon::Identicon
- Defined in:
- lib/idecon.rb
Constant Summary collapse
- SQUARE_SIZE =
250
- PIXEL_SIZE =
SQUARE_SIZE / 5
- DEFAULT_PATH =
'default.png'
- BACKGROUND_COLOR =
[255, 255, 255].freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(user_name, path = DEFAULT_PATH) ⇒ Identicon
constructor
A new instance of Identicon.
Constructor Details
#initialize(user_name, path = DEFAULT_PATH) ⇒ Identicon
Returns a new instance of Identicon.
16 17 18 19 20 |
# File 'lib/idecon.rb', line 16 def initialize(user_name, path = DEFAULT_PATH) @hash = Digest::MD5.hexdigest(user_name) @path = path @color = color end |
Instance Method Details
#generate ⇒ Object
22 23 24 25 26 |
# File 'lib/idecon.rb', line 22 def generate create_matrix create_image save_image(@path) end |