Skip to content

Commit

Permalink
Remove base64 gem dependency
Browse files Browse the repository at this point in the history
Inline the Base64 method code.

[Fixes #159]
  • Loading branch information
BrianHawley authored and mogest committed Jan 29, 2024
1 parent a2819b4 commit cd7184e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
4 changes: 1 addition & 3 deletions lib/prawn/svg/loaders/data.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'base64'

module Prawn::SVG::Loaders
class Data
REGEXP = %r{\Adata:image/(png|jpeg|svg\+xml);base64(;[a-z0-9]+)*,}i
Expand All @@ -13,7 +11,7 @@ def from_url(url)
'prawn-svg only supports base64-encoded image/png, image/jpeg, and image/svg+xml data URLs'
end

Base64.decode64(matches.post_match)
matches.post_match.unpack1('m')
end
end
end
1 change: 0 additions & 1 deletion prawn-svg.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Gem::Specification.new do |gem|

gem.required_ruby_version = '>= 2.5.0'

gem.add_runtime_dependency 'base64', '~> 0.1.0'
gem.add_runtime_dependency 'css_parser', '~> 1.6'
gem.add_runtime_dependency 'matrix', '~> 0.4.2'
gem.add_runtime_dependency 'prawn', '>= 0.11.1', '< 3'
Expand Down

0 comments on commit cd7184e

Please sign in to comment.