47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/glossarist/gcr_metadata.rb', line 47
def self.from_concepts(concepts, register_data: nil, options: {})
stats = GcrStatistics.from_concepts(concepts)
rd = register_data
new(
shortname: options[:shortname] || rd&.[]("shortname") || rd&.[]("id"),
version: options[:version] || rd&.[]("version"),
title: options[:title] || rd&.[]("name"),
description: options[:description] || rd&.[]("description"),
owner: options[:owner],
tags: options[:tags] || [],
concept_count: concepts.length,
languages: stats.languages,
created_at: Time.now.utc.iso8601,
glossarist_version: Glossarist::VERSION,
schema_version: rd&.[]("schema_version") || SchemaMigration::CURRENT_SCHEMA_VERSION,
statistics: stats,
uri_prefix: options[:uri_prefix],
concept_uri_template: options[:concept_uri_template],
compiled_formats: options[:compiled_formats] || [],
external_references: derive_external_references(concepts),
)
end
|