lib/svgshield.rb in svgshield-0.1.3 vs lib/svgshield.rb in svgshield-0.1.4

- old
+ new

@@ -1,17 +1,17 @@ require 'rasem' require 'color' -require "svgshield/version" +require 'svgshield/version' class Svgshield attr_reader :shield def initialize(subject, status, color = '#aaa') color = Color::CSS[color] if color[0] == '#' - # subject_width = 37 - # status_width = 53 + # subject_width = 37 + # status_width = 53 full_width = 86 full_height = 20 @shield = Rasem::SVGImage.new(width: full_width, height: full_height) do linearGradient('b', x2: 0, y2: '100%') do @@ -24,11 +24,11 @@ end group 'clip-path' => 'url(#a)' do path fill: '#555', d: "M0 0h37v#{full_height}H0z" path fill: color, d: "M37 0h49v#{full_height}H37z" - path fill: 'url(#b)' d: "M0 0h#{full_width}v#{full_height}H0z" + path fill: 'url(#b)', d: "M0 0h#{full_width}v#{full_height}H0z" end group( fill: '#fff', 'text-anchor' => 'middle', @@ -50,10 +50,10 @@ private def string_width(string) # Output is (theoretically, anyway) in pixels - string.chars.inject(0) { |sum, char| sum + char_width(char) }.round 0 + string.chars.inject(0) { |a, e| a + char_width(e) }.round 0 end def char_width(char) { 'i' => 8.0,