fakefs 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abf14d547bbdb7ed5fa1ac7a10d5a875dd265c62e91c520b4da97ceb30046f60
4
- data.tar.gz: c08a6cd7a05a4f787bb4b2d1c3871c13a8687af50729e1e735ac4fae6575b014
3
+ metadata.gz: ac7a61d1e3f94ffbd8bf9e02b2bc067756d9a2ec5b6dedd9dd4591c014e86ddc
4
+ data.tar.gz: 849724752e1833ab9876f538910789178d78e20880be8803eb0bac0fd8f1f873
5
5
  SHA512:
6
- metadata.gz: 53512a81bcf2e8b22c43abec8989cef5490bfc69341fe63fd2cada07cd74447fcb26a135e2d0907a7bd29bf10dd072d53d6b87d1fc932edf7bcd139b6b2bcec6
7
- data.tar.gz: 1b4902e37c4fcd567ca90f1b98074c03b213b6d69206b1099c1f6cd5f97bf09402be7413f274cf9c02539dd1b135b72dbf9cde2ebc5c973b12200a058455f3b8
6
+ metadata.gz: 97c55be8f221b42ab6c3cb9e80ba1531f984b8c28d565f96ab6deef78dccfe2f822cfc163ffe3108d0e915903290e793b5fe58513e7ef7ffa7af732407242eb1
7
+ data.tar.gz: 749aa9b67e909e40a6eec857c0be44faa915fbb09d30066a0387be9692860053d393922582f601de9cde3955e999b329d1febec4fadba7fc9ef0eb0c700bf8d8
data/lib/fakefs/dir.rb CHANGED
@@ -37,6 +37,10 @@ module FakeFS
37
37
  end
38
38
  end
39
39
 
40
+ def children
41
+ each.to_a
42
+ end
43
+
40
44
  def pos
41
45
  @pointer
42
46
  end
@@ -96,9 +100,11 @@ module FakeFS
96
100
  end
97
101
 
98
102
  def self.each_child(dirname, &_block)
99
- Dir.open(dirname) do |file|
100
- next if ['.', '..'].include?(file)
101
- yield file
103
+ Dir.open(dirname) do |dir|
104
+ dir.each do |file|
105
+ next if ['.', '..'].include?(file)
106
+ yield file
107
+ end
102
108
  end
103
109
  end
104
110
 
@@ -114,7 +120,11 @@ module FakeFS
114
120
  end
115
121
 
116
122
  def self.foreach(dirname, &_block)
117
- Dir.open(dirname) { |file| yield file }
123
+ Dir.open(dirname) do |dir|
124
+ dir.each do |file|
125
+ yield file
126
+ end
127
+ end
118
128
  end
119
129
 
120
130
  def self.glob(pattern, _flags = 0, flags: _flags, base: nil, &block) # rubocop:disable Lint/UnderscorePrefixedVariableName
@@ -152,10 +162,13 @@ module FakeFS
152
162
  end
153
163
 
154
164
  def self.open(string, &_block)
165
+ dir = Dir.new(string)
155
166
  if block_given?
156
- Dir.new(string).each { |file| yield(file) }
167
+ result = yield(dir)
168
+ dir.close
169
+ result
157
170
  else
158
- Dir.new(string)
171
+ dir
159
172
  end
160
173
  end
161
174
 
@@ -1,7 +1,7 @@
1
1
  module FakeFS
2
2
  # Version module
3
3
  module Version
4
- VERSION = '2.1.0'.freeze
4
+ VERSION = '2.2.0'.freeze
5
5
 
6
6
  def self.to_s
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakefs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-02-08 00:00:00.000000000 Z
15
+ date: 2023-02-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bump