lib/prawn/icon/compatibility.rb in prawn-icon-2.5.0 vs lib/prawn/icon/compatibility.rb in prawn-icon-3.0.0
- old
+ new
@@ -7,18 +7,26 @@
# This is free software. Please see the LICENSE and COPYING files for details.
module Prawn
class Icon
class Compatibility
+ # @deprecated Use {Prawn::Icon::Compatibility.shims} instead
SHIMS = YAML.load_file(
- File.join(
- Base::FONTDIR,
+ Prawn::Icon.configuration.font_directory.join(
'fa4',
'shims.yml'
)
).freeze
+ class << self
+ def shims
+ @shims ||= YAML.load_file(
+ Icon.configuration.font_directory.join('fa4', 'shims.yml').to_s
+ )
+ end
+ end
+
attr_accessor :key
def initialize(opts = {})
self.key = opts.fetch(:key)
end
@@ -34,11 +42,11 @@
end
private
def map
- SHIMS.fetch(key) do
+ self.class.shims.fetch(key) do
# FontAwesome shim metadata assumes "fas" as the default
# font family if not explicity referenced.
"fas-#{key.sub(/fa-/, '')}"
end
end
@@ -46,10 +54,10 @@
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.
+ This compatibility layer will be removed in Prawn::Icon 4.0.0.
DEPRECATION
end
end
end
end