Class: Fontist::Resources::GoogleResource

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

Instance Method Summary collapse

Constructor Details

#initialize(resource, options = {}) ⇒ GoogleResource

Returns a new instance of GoogleResource.



4
5
6
7
# File 'lib/fontist/resources/google_resource.rb', line 4

def initialize(resource, options = {})
  @resource = resource
  @options = options
end

Instance Method Details

#files(source_names) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fontist/resources/google_resource.rb', line 9

def files(source_names)
  cached_paths = download_fonts(source_names)

  cached_paths.map do |path|
    Dir.mktmpdir do |dir|
      FileUtils.cp(path, dir)

      yield File.join(dir, File.basename(path))
    end
  end
end