letter_avatar 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f648e3d3e303081858371e1bbe2e164b76b68085
4
- data.tar.gz: 5b55acfe7f9f5df46eea21b8d0b3867485950102
3
+ metadata.gz: fa5863d77b3303b2c3c3e980f8a36c5b5be56a7e
4
+ data.tar.gz: 231c30256287ab8ba036ed2c5b572975709a4e22
5
5
  SHA512:
6
- metadata.gz: c3d835fedd766bda7395275f8e936703ffa323f2a6f0dc3c5050e1a6c24304cdd718c827df43af2ef0afdfbfa6d45d49bf0ba61d9e963d12ea173fcccf8bfaba
7
- data.tar.gz: 4db45918f3221758b818cecc57e008c299d1de98ce0ea766c1a67341e0f265baab4f1950d462c9dc4c4db9b7bdf04d129c45767f68a2624f5fbb1a7044ead5a9
6
+ metadata.gz: d4a6faab9ef6f4573cea674c1be1b37ea7339c20689bcf53e96a6a2354071f19811de50a0566b13ee981dfe01f4293c8cc345e8c2c5f429edae7609c5ac87682
7
+ data.tar.gz: a8f4b56a920aa3a6df72aa1ee8693a2ea7f1006d60d6e0ab82c5238dbb871569dfa7c8a656baf674c952a30952b927935f7356aa083a15e26a8ee7ccb5ca3450
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ 0.3.6
2
+ -----
3
+
4
+ - added `LetterAvatar.letters_count` config option.
5
+ - added `LetterAvatar.pointsize` config option.
6
+
1
7
  0.3.5
2
8
  -----
3
9
 
data/README.md CHANGED
@@ -4,6 +4,7 @@ Gem for creating letter avatar from user's name (or any other strong / character
4
4
 
5
5
  Code extracted from [discourse](https://www.discourse.org/) source (thanks guys!) - I needed this functionality in three projects, so here's the gem! :-)
6
6
 
7
+ [![Gem Version](https://badge.fury.io/rb/letter_avatar.svg)](https://badge.fury.io/rb/letter_avatar)
7
8
  [![Code Climate](https://codeclimate.com/github/ksz2k/letter_avatar/badges/gpa.svg)](https://codeclimate.com/github/ksz2k/letter_avatar)
8
9
 
9
10
  ## Examples
@@ -53,6 +54,8 @@ LetterAvatar.setup do |config|
53
54
  config.colors_palette = :iwanthue # default is :google
54
55
  config.weight = 500 # default is 300
55
56
  config.annotate_position = '-0+10' # default is -0+5
57
+  config.letters_count = 2 # default is 1
58
+ config.pointsize = 70 # default is 140
56
59
  end
57
60
  ```
58
61
 
@@ -18,7 +18,8 @@ module LetterAvatar
18
18
  def self.from_username(username)
19
19
  identity = new
20
20
  identity.color = LetterAvatar::Colors.for(username)
21
- identity.letter = username[0].upcase
21
+ letters = username.split(/\s+/).map {|word| word[0]}.join('')[0..LetterAvatar.letters_count - 1]
22
+ identity.letter = letters.upcase
22
23
 
23
24
  identity
24
25
  end
@@ -65,7 +66,7 @@ module LetterAvatar
65
66
  convert
66
67
  -size #{FULLSIZE}x#{FULLSIZE}
67
68
  xc:#{to_rgb(identity.color)}
68
- -pointsize 140
69
+ -pointsize #{LetterAvatar.pointsize}
69
70
  -font #{FONT_FILENAME}
70
71
  -weight #{LetterAvatar.weight}
71
72
  -fill '#{LetterAvatar.fill_color}'
@@ -39,5 +39,21 @@ module LetterAvatar
39
39
  def annotate_position=(v)
40
40
  @annotate_position = v
41
41
  end
42
+
43
+ def letters_count
44
+ @letters_count ||= 1
45
+ end
46
+
47
+ def letters_count=(v)
48
+ @letters_count = v
49
+ end
50
+
51
+ def pointsize
52
+ @pointsize ||= 140
53
+ end
54
+
55
+ def pointsize=(v)
56
+ @pointsize = v
57
+ end
42
58
  end
43
59
  end
@@ -1,3 +1,3 @@
1
1
  module LetterAvatar
2
- VERSION = '0.3.5'
2
+ VERSION = '0.3.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_avatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Discourse Developers
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-03-29 00:00:00.000000000 Z
14
+ date: 2017-05-12 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: Gem for creating letter avatar from user's name
17
17
  email:
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  version: '0'
51
51
  requirements: []
52
52
  rubyforge_project:
53
- rubygems_version: 2.5.1
53
+ rubygems_version: 2.6.10
54
54
  signing_key:
55
55
  specification_version: 4
56
56
  summary: Create nice initals avatars from your users usernames