Class: FaviconFactory::BaseAdapter
- Inherits:
-
Object
- Object
- FaviconFactory::BaseAdapter
show all
- Defined in:
- lib/favicon_factory/base_adapter.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(file:, params:, stderr:) ⇒ BaseAdapter
Returns a new instance of BaseAdapter.
17
18
19
20
21
|
# File 'lib/favicon_factory/base_adapter.rb', line 17
def initialize(file:, params:, stderr:)
@file = file
@params = params
@stderr = stderr
end
|
Class Method Details
.find ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/favicon_factory/base_adapter.rb', line 8
def find
if TTY::Which.which("vips") || TTY::Which.which("libvips")
VipsAdapter
elsif TTY::Which.which("magick") || TTY::Which.which("convert")
ImageMagickAdapter
end
end
|
Instance Method Details
#create_icons ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/favicon_factory/base_adapter.rb', line 23
def create_icons
create_by_name
.keys
.map { |name| Thread.new { create(name, params) } }
.each(&:join)
stderr.puts <<~TEXT
Info: Add the following to the `<head>`
<!-- favicons generated with the favicon_factory gem -->
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="icon" href="/favicon.ico" sizes="32x32">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/manifest.webmanifest">
TEXT
end
|