Class: Prawn::Icon::Compatibility

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/icon/compatibility.rb

Constant Summary collapse

SHIMS =
YAML.load_file(
  File.join(
    Base::FONTDIR,
    'fa4',
    'shims.yml'
  )
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Compatibility

Returns a new instance of Compatibility.



22
23
24
# File 'lib/prawn/icon/compatibility.rb', line 22

def initialize(opts = {})
  self.key = opts.fetch(:key)
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



20
21
22
# File 'lib/prawn/icon/compatibility.rb', line 20

def key
  @key
end

Instance Method Details

#translate(io = STDERR) ⇒ Object



26
27
28
29
30
31
32
33
34
# 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