letter_avatar 0.1.7 → 0.1.8

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: 8f99ca51c792e31c973755f7d47326c2ff5cac5b
4
- data.tar.gz: b2e1bb4decc7c938bff9277fe46aa9eccc9e91d6
3
+ metadata.gz: 6adcf631452c47ccdb6e77de595811bf972f91de
4
+ data.tar.gz: 4c5f444c83d9b32c035bead3d50c618306ae0775
5
5
  SHA512:
6
- metadata.gz: e469b57b28152aab0989e45d7770a7096b74b0a2b815ae6c4adc73be69d5ce60df4eb60c7e33859bab23dc86026852920911626886aa88641d12e249663fe96d
7
- data.tar.gz: e741c86d220eba607bf6f8dbade3fd36295de1753162c31af35e93a631e12f7879afa8ce543f79d7e41cbbe23c9aa7fa6b14fd344f982391749910848050ac52
6
+ metadata.gz: ecd96dc6fb72e9ed31806eff4d1c958a874da5d2e180e048579d7fb26984f3569d731082efd65f04ffeffd1a66866a5f60215cf46650f33608890b5b88ec3494
7
+ data.tar.gz: 8643f2ee02c117abe8afcd1dc87c16080431f83c1b80dfd06aa6520601296f6ab8e796a7e23849e710e8754c7abf3df31334fa4bbb1a7dc89be2ad6567faddd8
data/lib/letter_avatar.rb CHANGED
@@ -1,20 +1,10 @@
1
1
  require "letter_avatar/version"
2
+ require "letter_avatar/configuration"
2
3
  require "letter_avatar/avatar"
3
4
  require "letter_avatar/avatar_helper"
4
5
 
5
6
  module LetterAvatar
6
-
7
- mattr_accessor :cache_base_path
8
- @@cache_base_path = nil
9
-
10
- mattr_accessor :colors_palette
11
- @@colors_palette = :google
12
-
13
- mattr_accessor :weight
14
- @@weight = 300
15
-
16
- mattr_accessor :annotate_position
17
- @@annotate_position = '-0+5'
7
+ extend LetterAvatar::Configuration
18
8
 
19
9
  def self.setup(&block)
20
10
  yield(self)
@@ -1,6 +1,8 @@
1
1
  module LetterAvatar
2
2
  module Colors
3
3
 
4
+ PALETTES = [:google, :iwanthue]
5
+
4
6
  def self.for(username)
5
7
  public_send("with_#{LetterAvatar.colors_palette}", username) rescue with_google(username)
6
8
  end
@@ -0,0 +1,39 @@
1
+ require "letter_avatar/colors"
2
+
3
+ module LetterAvatar
4
+ module Configuration
5
+
6
+ def cache_base_path
7
+ Thread.current[:cache_base_path]
8
+ end
9
+
10
+ def cache_base_path=(v)
11
+ Thread.current[:cache_base_path] = v
12
+ end
13
+
14
+ def colors_palette
15
+ Thread.current[:colors_palette] ||= :google
16
+ end
17
+
18
+ def colors_palette=(v)
19
+ Thread.current[:colors_palette] = v if v.in?(Colors::PALETTES)
20
+ end
21
+
22
+ def weight
23
+ Thread.current[:weight] ||= 300
24
+ end
25
+
26
+ def weight=(v)
27
+ Thread.current[:weight] = v
28
+ end
29
+
30
+ def annotate_position
31
+ Thread.current[:annotate_position] ||= '-0+5'
32
+ end
33
+
34
+ def annotate_position=(v)
35
+ Thread.current[:annotate_position] = v
36
+ end
37
+
38
+ end
39
+ end
@@ -1,3 +1,3 @@
1
1
  module LetterAvatar
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
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.1.7
4
+ version: 0.1.8
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: 2016-02-15 00:00:00.000000000 Z
14
+ date: 2016-02-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: posix-spawn
@@ -74,6 +74,7 @@ files:
74
74
  - lib/letter_avatar/avatar.rb
75
75
  - lib/letter_avatar/avatar_helper.rb
76
76
  - lib/letter_avatar/colors.rb
77
+ - lib/letter_avatar/configuration.rb
77
78
  - lib/letter_avatar/has_avatar.rb
78
79
  - lib/letter_avatar/version.rb
79
80
  homepage: https://github.com/ksz2k/letter_avatar