Class: Glossarist::Validation::AssetIndex
- Inherits:
-
Object
- Object
- Glossarist::Validation::AssetIndex
- Defined in:
- lib/glossarist/validation/asset_index.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Class Method Summary collapse
- .build_from_concepts(concepts, dataset_path) ⇒ Object
- .build_from_directory(dataset_path) ⇒ Object
- .build_from_zip(zip_path) ⇒ Object
Instance Method Summary collapse
- #each_path(&block) ⇒ Object
-
#initialize ⇒ AssetIndex
constructor
A new instance of AssetIndex.
- #register(path) ⇒ Object
- #resolve?(path) ⇒ Boolean
Constructor Details
#initialize ⇒ AssetIndex
Returns a new instance of AssetIndex.
14 15 16 |
# File 'lib/glossarist/validation/asset_index.rb', line 14 def initialize @paths = Set.new end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
12 13 14 |
# File 'lib/glossarist/validation/asset_index.rb', line 12 def paths @paths end |
Class Method Details
.build_from_concepts(concepts, dataset_path) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/glossarist/validation/asset_index.rb', line 35 def self.build_from_concepts(concepts, dataset_path) index = new index_image_files(index, dataset_path) index_concept_assets(index, concepts) index end |
.build_from_directory(dataset_path) ⇒ Object
30 31 32 33 |
# File 'lib/glossarist/validation/asset_index.rb', line 30 def self.build_from_directory(dataset_path) concepts = ConceptCollector.collect(dataset_path) build_from_concepts(concepts, dataset_path) end |
.build_from_zip(zip_path) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/glossarist/validation/asset_index.rb', line 42 def self.build_from_zip(zip_path) index = new index_zip_images(index, zip_path) index_zip_concept_assets(index, zip_path) index end |
Instance Method Details
#each_path(&block) ⇒ Object
26 27 28 |
# File 'lib/glossarist/validation/asset_index.rb', line 26 def each_path(&block) @paths.each(&block) end |
#register(path) ⇒ Object
18 19 20 |
# File 'lib/glossarist/validation/asset_index.rb', line 18 def register(path) @paths.add(normalize_path(path)) end |
#resolve?(path) ⇒ Boolean
22 23 24 |
# File 'lib/glossarist/validation/asset_index.rb', line 22 def resolve?(path) @paths.include?(normalize_path(path)) end |