projects
/
ruby-cruxutils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added CruxUtils::Port.find. Patch by Rene Lengwinat.
[ruby-cruxutils.git]
/
lib
/
cruxutils
/
port.rb
diff --git
a/lib/cruxutils/port.rb
b/lib/cruxutils/port.rb
index 0e84fa57daa2ae21cdca40865972e066750cd66f..a1e839f66bcd3273ea8c72838ff52d8507c98191 100644
(file)
--- a/
lib/cruxutils/port.rb
+++ b/
lib/cruxutils/port.rb
@@
-15,7
+15,16
@@
class Port
COMMENT_MAP["Nice to have"] = :nice_to_have
def Port.open(dir)
COMMENT_MAP["Nice to have"] = :nice_to_have
def Port.open(dir)
- yield Port.new(dir)
+ tmp = Port.new(dir)
+ yield tmp
+ tmp
+ end
+
+ def Port.find(pattern)
+ PORTDIRS.inject([]) do |memo, pd|
+ tmp = Dir["#{pd}/#{pattern}"].map { |d| Port.new(d) }
+ memo.concat(tmp)
+ end
end
def initialize(dir)
end
def initialize(dir)