eac_ruby_utils 0.26.0 → 0.27.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: 637988e74b9a30818ce5ee3aac3518a19bd06d6fd54f0beeb4454e8a22be8aa2
4
- data.tar.gz: 68e8326e06264390c21d39ac34f0e45e5a4be8eabfaa7e6e4d0c588361d39bac
3
+ metadata.gz: ca2a6292acad5715493643a175a2760e7b3e21d4dbab227b611bd1956b997746
4
+ data.tar.gz: 0e422f58351345b5525bafb9b49c3008325d13d056c8026cc90f1ef64f21173d
5
5
  SHA512:
6
- metadata.gz: 7609e6ed7d307f7a70e25ecd4fe19281627bb7cbb4f8738c1c42184112707ca770ec67bb5f250a9ada3f3482957960cba757cae729bc4a09138a593b541ca7c6
7
- data.tar.gz: e61d1df96f1bcc092bbbed5bfb9a824a9bdbb0915f17da21f3bfeded8ed779713835d58917ca1d36b201b6d393d9dd33ee67b30e5a7c697ba90fda58ac321999
6
+ metadata.gz: c9a57c3229bc90546c0153a036e95a221ca952388c49d7cbeba188f6f8e1d7756516c08c504d03f0ca941a94c9321aee822ac0bdeff745e8be80eb4305315838
7
+ data.tar.gz: c0e1597137ed6b6e96f7ae339a420db7c8d0dd141a1014180ddf7988c9e765eaf0d627883e1d4152d8b3a3a3e512b5ec33eb9f151a479057f9ca399f69a6e098
@@ -2,7 +2,7 @@
2
2
 
3
3
  module EacRubyUtils
4
4
  class FilesystemTraverser
5
- attr_accessor :check_directory, :check_file, :recursive, :hidden_directories
5
+ attr_accessor :check_directory, :check_file, :recursive, :hidden_directories, :sort
6
6
 
7
7
  def check_path(path)
8
8
  path = ::Pathname.new(path.to_s) unless path.is_a?(::Pathname)
@@ -17,8 +17,20 @@ module EacRubyUtils
17
17
  recursive ? true : false
18
18
  end
19
19
 
20
+ def sort?
21
+ sort ? true : false
22
+ end
23
+
20
24
  private
21
25
 
26
+ def each_child(dir, &block)
27
+ if sort?
28
+ dir.each_child.sort_by { |p| [p.to_s] }.each(&block)
29
+ else
30
+ dir.each_child(&block)
31
+ end
32
+ end
33
+
22
34
  def process_directory?(level)
23
35
  level.zero? || recursive?
24
36
  end
@@ -27,8 +39,7 @@ module EacRubyUtils
27
39
  return unless process_directory?(level)
28
40
 
29
41
  user_check_directory(dir)
30
- dir.each_entry do |e|
31
- next if %(. ..).include?(e.basename.to_s)
42
+ each_child(dir) do |e|
32
43
  next unless !e.basename.to_s.start_with?('.') || hidden_directories?
33
44
 
34
45
  internal_check_path(dir.join(e), level + 1)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.26.0'
4
+ VERSION = '0.27.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport