Class: Glossarist::V1Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/glossarist/v1_reader.rb

Overview

An adapter to read concepts in V1 format, converts them to v2 format and load into glossarist concept model.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load_concept_from_file(filename) ⇒ Object



7
8
9
# File 'lib/glossarist/v1_reader.rb', line 7

def self.load_concept_from_file(filename)
  new.load_concept_from_file(filename)
end

Instance Method Details

#load_concept_from_file(filename) ⇒ Object



11
12
13
14
# File 'lib/glossarist/v1_reader.rb', line 11

def load_concept_from_file(filename)
  concept_hash = Psych.safe_load(File.read(filename), permitted_classes: [Date, Time])
  Config.class_for(:managed_concept).new(generate_v2_concept_hash(concept_hash))
end