class Prawn::Icon::Compatibility
Constants
- SHIMS
Attributes
key[RW]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/prawn/icon/compatibility.rb, line 22 def initialize(opts = {}) self.key = opts.fetch(:key) end
Public Instance Methods
translate(io = STDERR)
click to toggle source
# File lib/prawn/icon/compatibility.rb, line 26 def translate(io = STDERR) @translate ||= begin if key.start_with?('fa-') map.tap { |replaced| warning(replaced, key, io) } else key end end end
Private Instance Methods
map()
click to toggle source
# File lib/prawn/icon/compatibility.rb, line 38 def map SHIMS.fetch(key) do # FontAwesome shim metadata assumes "fas" as the default # font family if not explicity referenced. "fas-#{key.sub(/fa-/, '')}" end end
warning(new_key, old_key, io)
click to toggle source
# File lib/prawn/icon/compatibility.rb, line 46 def warning(new_key, old_key, io) io.puts <<-DEPRECATION [Prawn::Icon - DEPRECATION WARNING] FontAwesome 4 icon was referenced as '#{old_key}'. Use the FontAwesome 5 icon '#{new_key}' instead. This compatibility layer will be removed in Prawn::Icon 3.0.0. DEPRECATION end