Sha256: c4ec995455aa429207202b1f6028a415b4917621f9293c8e9105b30848c35d6c
Contents?: true
Size: 803 Bytes
Versions: 5
Compression:
Stored size: 803 Bytes
Contents
require_relative "concept" module Tc211::Termbase class ConceptCollection < Hash def add_term(term) if self[term.id] self[term.id].add_term(term) else self[term.id] = Concept.new( id: term.id, terms: [term], ) end end def to_hash inject({}) do |acc, (id, concept)| acc.merge!(id => concept.to_hash) end end def to_file(filename) File.open(filename, "w") do |file| file.write(to_hash.to_yaml) end end def to_concept_collection collection = ::Glossarist::ManagedConceptCollection.new values.each do |term_concept| next if term_concept.nil? collection.store(term_concept.to_glossarist_concept) end collection end end end
Version data entries
5 entries across 5 versions & 1 rubygems