shellopts 2.4.0 → 2.4.1

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: 68428ade0dd8ec48fa85a8d43362743d6dc5595d9f4af3347d0fa402eaf0e7bb
4
- data.tar.gz: 51404fbc53ddbacb0b7a4552777e3de7c8abce1d508782f6c901da4b2cd332ba
3
+ metadata.gz: 53f85a46df1cf2280e591fbf996781c73e3ddb3dfe88ede023f6ef29f26995a4
4
+ data.tar.gz: 0ffb37c5f3843e92676004994600687dec0db89afccd20dea984998692e160a8
5
5
  SHA512:
6
- metadata.gz: ca5499680c53cc74388102b130eb9a7dfc7dc53ba7556615991d93d882ddc4993e1854891d78bbd97ccb4d37e8d493fb1c4e199cc4361f96ddb2e55c536f4cc7
7
- data.tar.gz: d75bef2e9b154a0332ed55a272341072654db8c615c5e4c9a27a94823efd6bae354fe32ca14679c92553af3e0e4f69f50ca3aeb675c5149d8394195f1f5a9f4a
6
+ metadata.gz: e67de152c69ae86557ec6898e7b0402d4188b8ca57a53128cfd7b3521655e80aadbc6114bcf943101f1a4012216604703dba54ae2a6921019d228b0b343b1837
7
+ data.tar.gz: bfe12de981b2504514cd42c81f64511d01fe7948d1d8a563b2f34473d30fa8cd7e5cc22f550e9e81bd3a31ff3da863adbc60dd33ffd9fed53ea69d0bc8907a62
@@ -60,6 +60,17 @@ module ShellOpts
60
60
  class FileArgument < ArgumentType
61
61
  attr_reader :kind
62
62
 
63
+ def subject # Used in error messages
64
+ @subject ||=
65
+ case kind
66
+ when :file, :efile, :nfile, :ifile, :ofile; "file"
67
+ when :dir, :edir, :ndir; "directory"
68
+ when :path, :epath, :npath; "path"
69
+ else
70
+ raise ArgumentError
71
+ end
72
+ end
73
+
63
74
  def initialize(kind)
64
75
  constrain kind, :file, :dir, :path, :efile, :edir, :epath, :nfile, :ndir, :npath, :ifile, :ofile
65
76
  @kind = kind
@@ -128,15 +139,6 @@ module ShellOpts
128
139
 
129
140
  protected
130
141
  def match_path(name, literal, kind, method, mode)
131
- subject =
132
- case kind
133
- when :file, :efile, :nfile, :ifile, :ofile; "file"
134
- when :dir, :edir, :ndir; "directory"
135
- when :path, :epath, :npath; "path"
136
- else
137
- raise ArgumentError
138
- end
139
-
140
142
  # file exists and is the rigth type?
141
143
  if File.send(method, literal)
142
144
  if mode == :new
@@ -174,7 +176,7 @@ module ShellOpts
174
176
  set_message "Illegal path in #{name}: #{literal}"
175
177
  end
176
178
  else
177
- set_message "Can't find #{literal}"
179
+ set_message "Can't find #{subject} #{literal}"
178
180
  end
179
181
  end
180
182
  end
@@ -1,3 +1,3 @@
1
1
  module ShellOpts
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shellopts
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-31 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: forward_to