dlister 0.0.1 → 0.0.2

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.
@@ -46,22 +46,29 @@ module Dlister
46
46
  end
47
47
 
48
48
  def entry_sort entries
49
- order = [:directory, :executable, :file, :link, :invalid_link]
49
+ entries.sort do |a, b|
50
+ sort_precendence a, b
51
+ end
52
+ end
53
+
54
+ def sort_precendence a, b
55
+ order = [:directory, :executable, :file, :link, :invalid_link, :not_found]
50
56
 
51
- entries.sort do |(entry_a, attr_a), (entry_b, attr_b)|
52
- rtype_a, rtype_b = attr_a[:real_type], attr_b[:real_type]
57
+ entry_a, attr_a = a
58
+ entry_b, attr_b = b
53
59
 
54
- rtype_sort = order.index(rtype_a) <=> order.index(rtype_b)
60
+ rtype_a, rtype_b = attr_a[:real_type], attr_b[:real_type]
55
61
 
56
- if rtype_sort == 0 then
57
- if entry_a =~ /^\d/ && entry_b =~ /^\d/ then
58
- entry_a.to_i <=> entry_b.to_i
59
- else
60
- entry_a <=> entry_b
61
- end
62
+ rtype_sort = order.index(rtype_a) <=> order.index(rtype_b)
63
+
64
+ if rtype_sort == 0 then
65
+ if entry_a =~ /^\d/ && entry_b =~ /^\d/ then
66
+ entry_a.to_i <=> entry_b.to_i
62
67
  else
63
- rtype_sort
68
+ entry_a <=> entry_b
64
69
  end
70
+ else
71
+ rtype_sort
65
72
  end
66
73
  end
67
74
 
@@ -1,3 +1,3 @@
1
1
  module Dlister
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dlister
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: