avatarly 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +1 -0
- data/lib/avatarly.rb +7 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5e98906ebcb07d210eefb7bf69cfe6378a340a3
|
4
|
+
data.tar.gz: 5ab8a99a4c0de9beb69dc74dc35d47752d6638a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90d2e5d3dfcd089f6d3197270342ab8a07e518baad21ad0a0868a8d57189f05857f6bf73f0cf1e794653b2a4fac19293a0f4e6595f9333c7c0957e586389f397
|
7
|
+
data.tar.gz: c15d4019c45bafde779263e5ca4da4f5501d6b1fd118581f556a30a193d61230c4738a9de41a3bfa0155a5e48cf64a6e884ebe54e5fac7fa7f657deaef471e56
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,7 @@ the only required parameter is <tt>text</tt>. Other options that you can pass ar
|
|
51
51
|
* <tt>font</tt> (path to font - e.g. "#{Rails.root}/your_font.ttf")
|
52
52
|
* <tt>font_size</tt> (default: size / 2)
|
53
53
|
* <tt>format</tt> (default: png)
|
54
|
+
* <tt>lang</tt> (language code if unicode aware upcase required - e.g: :tr, default: nil)
|
54
55
|
|
55
56
|
As a result you will get an image blob - rest is up to you, do whatever you want with it.
|
56
57
|
|
data/lib/avatarly.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rvg/rvg'
|
2
2
|
require 'rfc822'
|
3
3
|
require 'pathname'
|
4
|
+
require 'unicode_utils'
|
4
5
|
|
5
6
|
class Avatarly
|
6
7
|
BACKGROUND_COLORS = [
|
@@ -15,7 +16,12 @@ class Avatarly
|
|
15
16
|
|
16
17
|
class << self
|
17
18
|
def generate_avatar(text, opts={})
|
18
|
-
|
19
|
+
if opts[:lang]
|
20
|
+
text = UnicodeUtils.upcase(initials(text.to_s.strip.gsub(/[^[[:word:]] ]/,'')), opts[:lang])
|
21
|
+
else
|
22
|
+
text = initials(text.to_s.strip.gsub(/[^\w ]/,'')).upcase
|
23
|
+
end
|
24
|
+
generate_image(text, parse_options(opts)).to_blob
|
19
25
|
end
|
20
26
|
|
21
27
|
def root
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avatarly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukasz Odziewa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: unicode_utils
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Avatarly is a simple gem for Ruby that creates gmail-like avatars with
|
42
56
|
initials, inspired by avatar-generator by johnnyhalife. See homepage for more information.
|
43
57
|
email: lukasz.odziewa@gmail.com
|
@@ -70,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
84
|
version: '0'
|
71
85
|
requirements: []
|
72
86
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.4.
|
87
|
+
rubygems_version: 2.4.5.1
|
74
88
|
signing_key:
|
75
89
|
specification_version: 4
|
76
90
|
summary: Simple gem for creating gmail-like user avatars with initials.
|