yaml-safe_load_stream 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/yaml/safe_load_stream.rb +7 -7
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6667796ca4fc279cf5671884e050f362480e906969e7e0ecaad671020bfe4e5
4
- data.tar.gz: b74152ff619992542f3e28d490778b93543ccbb62d61155725132b2e816adb01
3
+ metadata.gz: 0425e55837f2056ed9fc5cd0e0e68604283054c41ae66ac1238db1a4ac5559ba
4
+ data.tar.gz: 43c0d6bee081ae0314a43102c723a13c1a1fda60a08de757af087e2186dec81e
5
5
  SHA512:
6
- metadata.gz: b620a941b386afed374694009031a9dbdea7a2479adfa5e485f6bfd3c2b8be502dc0e29383dd1b1f07c0443d544e28eeaa2d03b95dfd50104036de9da128fac1
7
- data.tar.gz: bfd7f20f5f0b24d3271a7743feefdf02ef5b807b82ac491edd41296598b8851a861f09317577fcde7a6adf0bf9223ace762381d6d079474dbef199db13025745
6
+ metadata.gz: d5d3824687eae80db57d60f97801043621f362f3dbe26bf45fc46b6194f6c26bf724d01d297610078982f6a9ab2cd5d24ddb961e71eb934a9e41960626f202f1
7
+ data.tar.gz: 7d3e69ce593c00bacac0a7c973db4a0f369d0e53ad810260a2c3f23f2b229589c1a8e33176669565e03634b070fe3e7a92d83c4f9800b810d90a33df8bb04175
@@ -12,16 +12,16 @@ module YAMLSafeLoadStream
12
12
  # @yield [document] each document in the stream is yielded if a block is given
13
13
  # @return [Array] when a block is not given, returns an Array of documents
14
14
  module_function def safe_load_stream(yaml, filename = nil)
15
- streams = []
15
+ result = []
16
16
  ::YAML.parse_stream(yaml, filename) do |stream|
17
17
  raise_if_tags(stream, filename)
18
- if block_given?
19
- yield stream.to_ruby
20
- else
21
- streams << stream.to_ruby
22
- end
18
+ result << if block_given?
19
+ yield(stream.to_ruby)
20
+ else
21
+ stream.to_ruby
22
+ end
23
23
  end
24
- streams unless block_given?
24
+ result
25
25
  end
26
26
 
27
27
  module_function def raise_if_tags(obj, filename = nil, doc_num = 1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-safe_load_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kimmo Lehto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.0.0
86
+ rubygems_version: 3.0.2
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Adds YAML.safe_load_stream for safely parsing multi-document YAML streams