glossarist 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/glossarist/collection.rb +10 -6
- data/lib/glossarist/concept_manager.rb +2 -0
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8fa4ca87465329dfee265b0c813794fbb857d5bbd174c2f7f28f6b4e678f372
|
4
|
+
data.tar.gz: c83f9967b06603b4e756f47a8c9bd78ad89b0c1ac8201d6bfcd34c2efc0c5db4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06207f39595d5ba32421f836268c71a081b028b32183062096c994fef1d794007f32093992716c97a39e91ccda07879405d934d7ea4e9746cf14470fd6e48993
|
7
|
+
data.tar.gz: 53b67a4ed78221ea53e2d4d498a39bf01b487d1ec7682a39da16a00ae17dfabc0f162a4b39ea25a6a8dc4259c30e3f0c38835743fbda821b4f53c4dd77ea8318
|
@@ -65,21 +65,25 @@ module Glossarist
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
private def load_concept_from_file(filename)
|
69
|
-
Concept.from_h(Psych.safe_load(File.read(filename)))
|
70
|
-
end
|
71
|
-
|
72
68
|
# Writes all concepts to files.
|
73
69
|
def save_concepts
|
74
70
|
@index.each_value &method(:save_concept_to_file)
|
75
71
|
end
|
76
72
|
|
77
|
-
private
|
73
|
+
private
|
74
|
+
|
75
|
+
def load_concept_from_file(filename)
|
76
|
+
Concept.from_h(Psych.safe_load(File.read(filename)))
|
77
|
+
rescue Psych::SyntaxError => e
|
78
|
+
raise Glossarist::ParseError.new(filename: filename, line: e.line)
|
79
|
+
end
|
80
|
+
|
81
|
+
def save_concept_to_file(concept)
|
78
82
|
filename = File.join(path, "concept-#{concept.id}.yaml")
|
79
83
|
File.write(filename, Psych.dump(concept.to_h))
|
80
84
|
end
|
81
85
|
|
82
|
-
|
86
|
+
def concepts_glob
|
83
87
|
File.join(path, "concept-*.{yaml,yml}")
|
84
88
|
end
|
85
89
|
end
|
@@ -28,6 +28,8 @@ module Glossarist
|
|
28
28
|
|
29
29
|
def load_concept_from_file(filename)
|
30
30
|
ManagedConcept.new(Psych.safe_load(File.read(filename)))
|
31
|
+
rescue Psych::SyntaxError => e
|
32
|
+
raise Glossarist::ParseError.new(filename: filename, line: e.line)
|
31
33
|
end
|
32
34
|
|
33
35
|
def save_concept_to_file(concept)
|
data/lib/glossarist/version.rb
CHANGED
data/lib/glossarist.rb
CHANGED
@@ -33,7 +33,23 @@ require_relative "glossarist/config"
|
|
33
33
|
|
34
34
|
module Glossarist
|
35
35
|
class Error < StandardError; end
|
36
|
+
|
36
37
|
class InvalidTypeError < StandardError; end
|
38
|
+
|
39
|
+
class ParseError < StandardError
|
40
|
+
attr_accessor :line, :filename
|
41
|
+
|
42
|
+
def initialize(filename:, line: nil)
|
43
|
+
@filename = filename
|
44
|
+
@line = line
|
45
|
+
|
46
|
+
super()
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_s
|
50
|
+
"Unable to parse file: #{filename}, error on line: #{line}"
|
51
|
+
end
|
52
|
+
end
|
37
53
|
# Your code goes here...
|
38
54
|
|
39
55
|
def self.configure
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glossarist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton
|