fned 0.0.4 → 0.0.5

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.
@@ -25,11 +25,7 @@ module Fned
25
25
  # Filenames may be in any encoding, i.e. have an invalid encoding if
26
26
  # the default encoding is not binary. Therefore ensure that every
27
27
  # argument is in binary encoding.
28
- args = args.map do |str|
29
- str = str.dup
30
- str.force_encoding "binary"
31
- str
32
- end
28
+ args = args.map { |str| str.dup.force_encoding "binary" }
33
29
 
34
30
  options = {}
35
31
 
@@ -67,7 +63,7 @@ module Fned
67
63
  end
68
64
 
69
65
  def initialize(paths, options = {})
70
- @paths = paths.map { |file| Pathname.new(file) }
66
+ @paths = paths.map { |path| Pathname.new(path) }
71
67
  @options = {
72
68
  :verbose => false,
73
69
  :recursive => false,
@@ -95,15 +91,21 @@ module Fned
95
91
  # TODO: handle errors (ENOENT, ENOTDIR, ELOOP, EACCESS)
96
92
  return [path] unless path.lstat.directory?
97
93
 
98
- entries = path.entries.reject { |entry| %w(. ..).include?(entry.to_s) }
99
- entries.map! do |entry|
94
+ entries = path.entries
95
+ .map do |entry|
96
+ entry.to_s.force_encoding "binary"
97
+ end
98
+ .reject do |entry|
99
+ %w(. ..).include?(entry)
100
+ end
101
+ .map do |entry|
100
102
  if (path + entry).lstat.directory?
101
103
  path + "#{entry}/"
102
104
  else
103
105
  path + entry
104
106
  end
105
107
  end
106
- entries.sort_by! do |entry|
108
+ .sort_by do |entry|
107
109
  [entry.lstat.directory? ? 0 : 1, entry.basename]
108
110
  end
109
111
 
@@ -1,3 +1,3 @@
1
1
  module Fned
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fned
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-30 00:00:00.000000000 Z
12
+ date: 2012-02-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: fned allows you to use your favorite $EDITOR to edit filenames
15
15
  email: matled@gmx.net