Class: Fontist::Font
- Inherits:
-
Object
- Object
- Fontist::Font
- Defined in:
- lib/fontist/font.rb
Class Method Summary collapse
- .all ⇒ Object
- .find(name) ⇒ Object
- .install(name, options = {}) ⇒ Object
- .list(name) ⇒ Object
- .status(name) ⇒ Object
- .uninstall(name) ⇒ Object
Instance Method Summary collapse
- #all ⇒ Object
- #find ⇒ Object
-
#initialize(options = {}) ⇒ Font
constructor
A new instance of Font.
- #install ⇒ Object
- #list ⇒ Object
- #status ⇒ Object
- #uninstall ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Font
Returns a new instance of Font.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fontist/font.rb', line 7 def initialize( = {}) @name = [:name] @confirmation = [:confirmation] || "no" @hide_licenses = [:hide_licenses] @no_progress = [:no_progress] || false @force = [:force] || false @version = [:version] @smallest = [:smallest] @newest = [:newest] @size_limit = [:size_limit] check_or_create_fontist_path! end |
Class Method Details
.all ⇒ Object
21 22 23 |
# File 'lib/fontist/font.rb', line 21 def self.all new.all end |
.find(name) ⇒ Object
25 26 27 |
# File 'lib/fontist/font.rb', line 25 def self.find(name) new(name: name).find end |
.install(name, options = {}) ⇒ Object
29 30 31 |
# File 'lib/fontist/font.rb', line 29 def self.install(name, = {}) new(.merge(name: name)).install end |
.list(name) ⇒ Object
41 42 43 |
# File 'lib/fontist/font.rb', line 41 def self.list(name) new(name: name).list end |
.status(name) ⇒ Object
37 38 39 |
# File 'lib/fontist/font.rb', line 37 def self.status(name) new(name: name).status end |
.uninstall(name) ⇒ Object
33 34 35 |
# File 'lib/fontist/font.rb', line 33 def self.uninstall(name) new(name: name).uninstall end |
Instance Method Details
#all ⇒ Object
73 74 75 |
# File 'lib/fontist/font.rb', line 73 def all all_formulas.map(&:fonts).flatten end |
#find ⇒ Object
45 46 47 48 |
# File 'lib/fontist/font.rb', line 45 def find find_system_font || downloadable_font || manual_font || raise_non_supported_font end |
#install ⇒ Object
50 51 52 53 |
# File 'lib/fontist/font.rb', line 50 def install (find_system_font unless @force) || download_font || manual_font || raise_non_supported_font end |
#list ⇒ Object
67 68 69 70 71 |
# File 'lib/fontist/font.rb', line 67 def list return all_list unless @name font_list || raise_non_supported_font end |
#status ⇒ Object
60 61 62 63 64 65 |
# File 'lib/fontist/font.rb', line 60 def status return installed_paths unless @name find_system_font || downloadable_font || manual_font || raise_non_supported_font end |
#uninstall ⇒ Object
55 56 57 58 |
# File 'lib/fontist/font.rb', line 55 def uninstall uninstall_font || downloadable_font || manual_font || raise_non_supported_font end |