graphql-docs 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57b3bab2a270f24272f4dbd5f01e35b4ca808c69
4
- data.tar.gz: 40b5d99232276274abc5f96fd0cf3e6a3744ffe1
3
+ metadata.gz: 5808f244334e388f5ad5af6c83939e8e0617305a
4
+ data.tar.gz: f8d09947936ef457e044ace119172a060ab65132
5
5
  SHA512:
6
- metadata.gz: 44dbb949bd168632077b04c060766740929309f04353730d165518241633b5f5f814b01935ad854a1fd1307e4950936b0f054b6be388a96c58c827efd3f15d77
7
- data.tar.gz: acc2174c4f16ec02f995185c70817e337db9c045b57f9cc91a85c84036f9d1d7cc33692e49d5f2ff2811dec3c5aed6152c66bbf72a7e48d1e99bef1b8772c540
6
+ metadata.gz: d616288144247d6aa429030b3d705208b2e849eefba38a68eb7ee0aa0f31daa56ecc25b388734498e84f6a1515e1bb98a0524e2fb71cab3eaa96e0e574fa6e7d
7
+ data.tar.gz: 9ee27fe57dab6b9bab6f74d50095a0fefb0d4f3d084396f5998d2758c8f6cf70c0176a403507f29346bebf30df9da70d979f1e27e7d0101632d1e318d3302cb6
@@ -39,20 +39,8 @@ module GraphQLDocs
39
39
 
40
40
  if has_yaml?(contents)
41
41
  # Split data
42
- pieces = yaml_split(contents)
43
- if pieces.size < 4
44
- raise RuntimeError.new(
45
- "The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.",
46
- )
47
- end
48
- # Parse
49
- begin
50
- meta = YAML.load(pieces[2]) || {}
51
- opts = opts.merge(meta)
52
- rescue Exception => e # rubocop:disable Lint/RescueException
53
- raise "Could not parse YAML for #{name}: #{e.message}"
54
- end
55
- contents = pieces[4]
42
+ meta, contents = split_into_metadata_and_contents(contents)
43
+ opts = opts.merge(meta)
56
44
  end
57
45
 
58
46
  contents = @pipeline.to_html(contents)
@@ -69,6 +57,23 @@ module GraphQLDocs
69
57
  contents.split(/^(-{5}|-{3})[ \t]*\r?\n?/, 3)
70
58
  end
71
59
 
60
+ def split_into_metadata_and_contents(contents)
61
+ opts = {}
62
+ pieces = yaml_split(contents)
63
+ if pieces.size < 4
64
+ raise RuntimeError.new(
65
+ "The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.",
66
+ )
67
+ end
68
+ # Parse
69
+ begin
70
+ meta = YAML.load(pieces[2]) || {}
71
+ rescue Exception => e # rubocop:disable Lint/RescueException
72
+ raise "Could not parse YAML for #{name}: #{e.message}"
73
+ end
74
+ [meta, pieces[4]]
75
+ end
76
+
72
77
  private
73
78
 
74
79
  def filter_key(s)
@@ -1,3 +1,3 @@
1
1
  module GraphQLDocs
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian