Class: Unitsdb::Commands::Qudt::Check
- Defined in:
- lib/unitsdb/commands/qudt/check.rb
Constant Summary collapse
- ENTITY_TYPES =
Constants
%w[units quantities dimensions unit_systems prefixes].freeze
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Unitsdb::Commands::Base
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/unitsdb/commands/qudt/check.rb', line 13 def run # Get options entity_type = @options[:entity_type]&.downcase direction = @options[:direction]&.downcase || "both" output_dir = @options[:output_updated_database] include_potential = @options[:include_potential_matches] || false database_path = @options[:database] ttl_dir = @options[:ttl_dir] source_type = ttl_dir ? :file : :url # Validate parameters validate_parameters(direction, ttl_dir, source_type) # Use the path as-is without expansion puts "Using database directory: #{database_path}" @db = Unitsdb::Database.from_db(database_path) if source_type == :file puts "Using QUDT TTL directory: #{ttl_dir}" else puts "Downloading QUDT vocabularies from online sources" end puts "Include potential matches: #{include_potential ? 'Yes' : 'No'}" # Parse QUDT vocabularies qudt_data = TtlParser.parse_qudt_vocabularies( source_type: source_type, ttl_dir: ttl_dir, ) # Process entity types process_entities(entity_type, qudt_data, direction, output_dir, include_potential) end |