scoobydoo 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/scoobydoo.rb +7 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ae5a44b2fcb58015c64b5ae631a49343a463859
4
- data.tar.gz: e542146b178fee79e4404cbaf6e46c787ebc0b94
3
+ metadata.gz: f3ee58587459176b289e5d3e17f09be6b0b4f466
4
+ data.tar.gz: 476567fae7d105db1cf7ab823997e5179e80942b
5
5
  SHA512:
6
- metadata.gz: ed07a04c983495c6848d0d43bef8ccf7e4f1c17e84b59406c5a9397609e0145d04afafa839b6075ee55ae263067057b3d1b83de1627f8dad18a6e6b43d21174f
7
- data.tar.gz: ded16793ba8b7534d1cf82ebea1e966156c633ae0398a96921d92c1fcecbed7a765accff0d27bc5c90c103ddb911b212fb7345e0ff41f52b65cdbcdc3489929c
6
+ metadata.gz: 8c7d4cd7c5ab994e31b9c707009aad681f6b347f15965dc4e0ea69b3d1443dffa6ebdefce6eb0a33c9e90f0cbb283ac9ed3528b0b001f4b9d54f36724393fc80
7
+ data.tar.gz: 0ef48f15d55e92b283fe2cf778fae85a7536702bcb43c47184be485d6ba84e51379b8e1c9c0572a9c86f530cf1bf89c439a05a18fb52deba77074e2d093ae505
@@ -1,7 +1,13 @@
1
1
  require "pathname"
2
2
 
3
3
  class ScoobyDoo
4
+ @@cache = Hash.new
5
+
4
6
  def self.where_are_you(cmd)
7
+ if (@@cache.has_key?(cmd))
8
+ return @@cache[cmd]
9
+ end
10
+
5
11
  if (cmd.include?(File::PATH_SEPARATOR))
6
12
  exe = Pathname.new(cmd).expand_path
7
13
  return (exe.executable? && !exe.directory?) ? exe : nil
@@ -12,6 +18,7 @@ class ScoobyDoo
12
18
  exts.each do |ext|
13
19
  exe = File.join(path, "#{cmd}#{ext}")
14
20
  if (File.executable?(exe) && !File.directory?(exe))
21
+ @@cache[cmd] = exe
15
22
  return exe
16
23
  end
17
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoobydoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Cross-platform which for ruby.
14
14
  email: mjwhitta@gmail.com