Class: Fontist::FontInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/fontist/font_installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formula, font_name: nil, no_progress: false, location: nil) ⇒ FontInstaller

Returns a new instance of FontInstaller.



12
13
14
15
16
17
# File 'lib/fontist/font_installer.rb', line 12

def initialize(formula, font_name: nil, no_progress: false, location: nil)
  @formula = formula
  @font_name = font_name
  @no_progress = no_progress
  @location = InstallLocation.create(formula, location_type: location)
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



10
11
12
# File 'lib/fontist/font_installer.rb', line 10

def location
  @location
end

Instance Method Details

#install(confirmation:) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/fontist/font_installer.rb', line 19

def install(confirmation:)
  raise_platform_error unless platform_compatible?
  raise_fontist_version_error unless supported_version?
  raise_licensing_error unless license_is_accepted?(confirmation)

  install_font
end