supertramp 0.6.1 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e782e06f94b9db00d129ed79674a626cba15d6dd4aba1f9412ff487600e9e77
4
- data.tar.gz: 46f4119919f82b072578a62009d628e69215745d4d3f33f3bc1c2c624969ae9a
3
+ metadata.gz: 6207da41ee6c3835ff5280521e790f0c3b955d4f0296402a803442713c1939a7
4
+ data.tar.gz: 81374ecd348906a1d35db38230044b13f579c3799674b8ba27de551d8f9b5d3a
5
5
  SHA512:
6
- metadata.gz: 66b40bd408dbad5300c9659b0fd2cb3e7f38df1d0d3f705bc9f192ebb8c826dec8d648bd66df517897a8787432a44d16d98be6ba93a76e399e0448228854967c
7
- data.tar.gz: 19ef9e61382f857bf1a0e18fddfa970bff2695abd60fbe72d5de6b725b357f971f46600d5e84c50a52dda43a221563558ad65a143edcf0effad29eb0f6879755
6
+ metadata.gz: 138b06a3970592c84e58af553a74c9048e25bf76f8940892e0b307b8ff5fb8bcc1707a36085f091cd734a0c498a80690a0aafa02f4fa07ff2b58879076a1b80b
7
+ data.tar.gz: 19a473b418f266ec8946d164b5651866d1c2244f9ba979ff2f2bcd3bc08a35f75be8c289fa1e96fc3af632696c6248a9e8ca6a166bdd52e9322e2a283b1818b7
@@ -24,6 +24,12 @@ class Supertramp
24
24
  bind_template("_#{@shape}")
25
25
  end
26
26
 
27
+ # Scale the text size proportinaly based on the number of initials
28
+ # to ensure they all fit, with a max size of 26
29
+ def text_size
30
+ [(51.0 / @initials.chars.count).ceil, 26].min
31
+ end
32
+
27
33
  private
28
34
 
29
35
  def bind_template(file)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Supertramp
4
- VERSION = '0.6.1'
4
+ VERSION = '0.7.0'
5
5
  end
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50">
3
3
  <%= shape %>
4
- <text fill="#fff" font-family="Helvetica,Arial,sans-serif" font-size="26" font-weight="500" x="50%" y="55%" dominant-baseline="middle" text-anchor="middle">
4
+ <text fill="#fff" font-family="Helvetica,Arial,sans-serif" font-size="<%= text_size %>" font-weight="500" x="50%" y="55%" dominant-baseline="middle" text-anchor="middle">
5
5
  <%= @initials %>
6
6
  </text>
7
7
  </svg>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supertramp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Bearman