rails_gravatar 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_gravatar.rb +25 -12
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08b557ae1df7784bf4b9b7a8cf8a0f7a9af0fef4887726dafdb1fd0bca5d3fcd'
|
4
|
+
data.tar.gz: cb5fa92e0f94b0de956421d6fc721e185a3da0a2e5a0f42a42213bee43f31351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cc8c5b0c9b8c89560d7ad04399a83a05f90f3c81c0fbfcba95d922fa1463b69409947beb32d0667a706c1adf86be594959b720eb4ac6509c7e032c51e11fc58
|
7
|
+
data.tar.gz: 9a454ec8614cc8e809a9b4cecac796cf604bbb6596a4b026a7066981a5b623711dcfe58be09eea1b92c1c5db42bca96ee5ee1b44a08e0a8b778f38580c89c51d
|
data/lib/rails_gravatar.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "./version"
|
2
3
|
require "digest/md5"
|
3
4
|
require "cgi"
|
4
5
|
require "action_view"
|
@@ -32,26 +33,38 @@ class RailsGravatar
|
|
32
33
|
def src
|
33
34
|
[
|
34
35
|
"//www.gravatar.com/avatar/",
|
35
|
-
|
36
|
-
"?
|
37
|
-
|
36
|
+
email_address_digest,
|
37
|
+
"?",
|
38
|
+
size_param,
|
39
|
+
fallback_image_url_param
|
38
40
|
].join
|
39
|
-
rescue Exception => e
|
40
|
-
nil
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
|
43
|
+
def email_address_digest
|
44
|
+
Digest::MD5.hexdigest(email_address)
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
48
|
-
|
47
|
+
def email_address
|
48
|
+
@email_address.downcase.strip
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
def size_param
|
52
|
+
"s=#{size}"
|
53
|
+
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
+
def size
|
56
|
+
@size.clamp(1, 2048)
|
57
|
+
end
|
55
58
|
|
59
|
+
def fallback_image_url_param
|
60
|
+
@fallback_image_url ? "&d=#{CGI.escape(@fallback_image_url)}" : nil
|
61
|
+
end
|
56
62
|
|
63
|
+
def tag
|
64
|
+
content_tag(:img, nil, src: src, class: "gravatar", alt: @alt_text)
|
65
|
+
end
|
57
66
|
|
67
|
+
def prefetch_dns_tag
|
68
|
+
content_tag(:link, nil, rel: "dns-prefetch", href: "//gravatar.com")
|
69
|
+
end
|
70
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_gravatar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricky Chilcott
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -45,11 +45,11 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- lib/rails_gravatar.rb
|
48
|
-
homepage:
|
48
|
+
homepage: https://github.com/mission-met/rails_gravatar
|
49
49
|
licenses:
|
50
50
|
- MIT
|
51
51
|
metadata: {}
|
52
|
-
post_install_message:
|
52
|
+
post_install_message:
|
53
53
|
rdoc_options: []
|
54
54
|
require_paths:
|
55
55
|
- lib
|
@@ -64,8 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
68
|
-
signing_key:
|
67
|
+
rubygems_version: 3.1.2
|
68
|
+
signing_key:
|
69
69
|
specification_version: 4
|
70
|
-
summary:
|
70
|
+
summary: rails_gravatar
|
71
71
|
test_files: []
|