Class: Glossarist::GcrPackage
- Inherits:
-
Object
- Object
- Glossarist::GcrPackage
- Defined in:
- lib/glossarist/gcr_package.rb
Instance Attribute Summary collapse
-
#concepts ⇒ Object
readonly
Returns the value of attribute concepts.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#zip_path ⇒ Object
readonly
Returns the value of attribute zip_path.
Class Method Summary collapse
- .create(concepts:, metadata:, output_path:, register_data: nil) ⇒ Object
-
.create_from_directory(dir, output:, shortname:, version:, title: nil, description: nil, owner: nil, tags: [], register_yaml: nil, uri_prefix: nil, concept_uri_template: nil, streaming: false) ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/ParameterLists.
- .load(zip_path) ⇒ Object
Instance Method Summary collapse
-
#initialize(zip_path) ⇒ GcrPackage
constructor
A new instance of GcrPackage.
- #validate ⇒ Object
Constructor Details
#initialize(zip_path) ⇒ GcrPackage
Returns a new instance of GcrPackage.
10 11 12 13 14 |
# File 'lib/glossarist/gcr_package.rb', line 10 def initialize(zip_path) @zip_path = zip_path @metadata = nil @concepts = [] end |
Instance Attribute Details
#concepts ⇒ Object (readonly)
Returns the value of attribute concepts.
8 9 10 |
# File 'lib/glossarist/gcr_package.rb', line 8 def concepts @concepts end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/glossarist/gcr_package.rb', line 8 def @metadata end |
#zip_path ⇒ Object (readonly)
Returns the value of attribute zip_path.
8 9 10 |
# File 'lib/glossarist/gcr_package.rb', line 8 def zip_path @zip_path end |
Class Method Details
.create(concepts:, metadata:, output_path:, register_data: nil) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/glossarist/gcr_package.rb', line 16 def self.create(concepts:, metadata:, output_path:, register_data: nil) FileUtils.mkdir_p(File.dirname(output_path)) package = new(output_path) package.send(:write, concepts, , register_data) package end |
.create_from_directory(dir, output:, shortname:, version:, title: nil, description: nil, owner: nil, tags: [], register_yaml: nil, uri_prefix: nil, concept_uri_template: nil, streaming: false) ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/glossarist/gcr_package.rb', line 29 def self.create_from_directory(dir, output:, shortname:, version:, # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists title: nil, description: nil, owner: nil, tags: [], register_yaml: nil, uri_prefix: nil, concept_uri_template: nil, streaming: false) dir = File.(dir) if streaming create_streaming(dir, output: output, shortname: shortname, version: version, title: title, description: description, owner: owner, tags: , register_yaml: register_yaml, uri_prefix: uri_prefix, concept_uri_template: concept_uri_template) else create_batch(dir, output: output, shortname: shortname, version: version, title: title, description: description, owner: owner, tags: , register_yaml: register_yaml, uri_prefix: uri_prefix, concept_uri_template: concept_uri_template) end end |
.load(zip_path) ⇒ Object
23 24 25 26 27 |
# File 'lib/glossarist/gcr_package.rb', line 23 def self.load(zip_path) package = new(zip_path) package.send(:read) package end |
Instance Method Details
#validate ⇒ Object
51 52 53 |
# File 'lib/glossarist/gcr_package.rb', line 51 def validate GcrValidator.new.validate(@zip_path) end |