Class: Pakyow::Assets::External Private
- Inherits:
-
Object
- Object
- Pakyow::Assets::External
- Defined in:
- lib/pakyow/assets/external.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Downloader
Instance Attribute Summary collapse
- #name ⇒ Object readonly private
- #package ⇒ Object readonly private
- #version ⇒ Object readonly private
Instance Method Summary collapse
- #exist? ⇒ Boolean private
- #fetch! ⇒ Object private
-
#initialize(name, version:, package:, files:, config:) ⇒ External
constructor
private
A new instance of External.
Constructor Details
#initialize(name, version:, package:, files:, config:) ⇒ External
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of External.
11 12 13 14 15 |
# File 'lib/pakyow/assets/external.rb', line 11 def initialize(name, version:, package:, files:, config:) @name, @version, @config = name, version, config @package = package || name @files = files || [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/pakyow/assets/external.rb', line 9 def name @name end |
#package ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/pakyow/assets/external.rb', line 9 def package @package end |
#version ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/pakyow/assets/external.rb', line 9 def version @version end |
Instance Method Details
#exist? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pakyow/assets/external.rb', line 17 def exist? if @files.empty? Dir.glob(File.join(@config.externals.path, "#{@name}*.js")).any? else !@files.any? { |file| if File.basename(file, File.extname(file)) == @name.to_s Dir.glob(File.join(@config.externals.path, "#{@name}*.js")).empty? else Dir.glob(File.join(@config.externals.path, "#{@name}*__#{File.basename(file, File.extname(file))}.js")).empty? end } end end |
#fetch! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 37 38 39 |
# File 'lib/pakyow/assets/external.rb', line 31 def fetch! if @files.empty? fetch_file!(nil) else @files.each do |file| fetch_file!(file) end end end |