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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rails_gravatar.rb +25 -12
  3. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 733c4feb5eecf01dc5d4f6945c1ff248f030ba3f458ea5aee170a17baf3538cf
4
- data.tar.gz: 534cc069a665c3981872a8a1c16aa28efda4b7509104220da329d56d346da7c6
3
+ metadata.gz: '08b557ae1df7784bf4b9b7a8cf8a0f7a9af0fef4887726dafdb1fd0bca5d3fcd'
4
+ data.tar.gz: cb5fa92e0f94b0de956421d6fc721e185a3da0a2e5a0f42a42213bee43f31351
5
5
  SHA512:
6
- metadata.gz: db2d472104a7496fb7fca30f28095ef2212ebc6c0e74c9f499696d32ab56e6b4a561184fef04e957a573dc27a32c44033fc2d8eca82bef915633e210e827f276
7
- data.tar.gz: bdade91dea7fa02f27f0a853dd7df5a0c08e616196544417395a8eabc78d6ad52275deb8c088b1544df9657a8d418f2899ec42859fb49f9bf4403006805fecee
6
+ metadata.gz: 5cc8c5b0c9b8c89560d7ad04399a83a05f90f3c81c0fbfcba95d922fa1463b69409947beb32d0667a706c1adf86be594959b720eb4ac6509c7e032c51e11fc58
7
+ data.tar.gz: 9a454ec8614cc8e809a9b4cecac796cf604bbb6596a4b026a7066981a5b623711dcfe58be09eea1b92c1c5db42bca96ee5ee1b44a08e0a8b778f38580c89c51d
@@ -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
- Digest::MD5.hexdigest(email_address.downcase.strip),
36
- "?s=#{size.clamp(1, 2048)}",
37
- fallback_image_url ? "&d=#{CGI.escape(fallback_image_url)}" : nil
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 tag
44
- content_tag(:img, nil, src: src, class: "gravatar", alt: alt_text)
43
+ def email_address_digest
44
+ Digest::MD5.hexdigest(email_address)
45
45
  end
46
46
 
47
- def prefetch_dns_tag
48
- content_tag(:link, nil, rel: "dns-prefetch", href: "//gravatar.com")
47
+ def email_address
48
+ @email_address.downcase.strip
49
49
  end
50
50
 
51
- private
51
+ def size_param
52
+ "s=#{size}"
53
+ end
52
54
 
53
- attr_reader :email_address, :size, :fallback_image_url, :alt_text
54
- end
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.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-02 00:00:00.000000000 Z
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: http://github.com/missionmet/rails-gravatar
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.0.3
68
- signing_key:
67
+ rubygems_version: 3.1.2
68
+ signing_key:
69
69
  specification_version: 4
70
- summary: rails-gravatar
70
+ summary: rails_gravatar
71
71
  test_files: []