Class: Avatarly
- Inherits:
-
Object
- Object
- Avatarly
- Defined in:
- lib/avatarly.rb
Constant Summary collapse
- BACKGROUND_COLORS =
[ "#ff4040", "#7f2020", "#cc5c33", "#734939", "#bf9c8f", "#995200", "#4c2900", "#f2a200", "#ffd580", "#332b1a", "#4c3d00", "#ffee00", "#b0b386", "#64664d", "#6c8020", "#c3d96c", "#143300", "#19bf00", "#53a669", "#bfffd9", "#40ffbf", "#1a332e", "#00b3a7", "#165955", "#00b8e6", "#69818c", "#005ce6", "#6086bf", "#000e66", "#202440", "#393973", "#4700b3", "#2b0d33", "#aa86b3", "#ee00ff", "#bf60b9", "#4d3949", "#ff00aa", "#7f0044", "#f20061", "#330007", "#d96c7b" ].freeze
Class Method Summary collapse
Class Method Details
.generate_avatar(text, opts = {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/avatarly.rb', line 18 def generate_avatar(text, opts={}) if opts[:lang] text = UnicodeUtils.upcase(initials(text.to_s.gsub(/[^[[:word:]] ]/,'').strip, opts), opts[:lang]) else text = initials(text.to_s.gsub(/[^\w ]/,'').strip, opts).upcase end generate_image(text, (opts)).to_blob end |
.lib ⇒ Object
31 32 33 |
# File 'lib/avatarly.rb', line 31 def lib File.join root, 'lib' end |
.root ⇒ Object
27 28 29 |
# File 'lib/avatarly.rb', line 27 def root File. '../..', __FILE__ end |