Class: Speckle::List::DirExpander
- Inherits:
-
Object
- Object
- Speckle::List::DirExpander
- Defined in:
- lib/speckle/list/dir_expander.rb
Instance Method Summary collapse
-
#initialize(pattern) ⇒ DirExpander
constructor
A new instance of DirExpander.
- #run(item) ⇒ Object
Constructor Details
#initialize(pattern) ⇒ DirExpander
Returns a new instance of DirExpander.
4 5 6 |
# File 'lib/speckle/list/dir_expander.rb', line 4 def initialize(pattern) @pattern = pattern end |
Instance Method Details
#run(item) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/speckle/list/dir_expander.rb', line 8 def run(item) pattern = "#{item}/#{@pattern}" #puts "DirExpander:run #{item}, pattern=#{pattern}" #puts "is dir = #{File.directory?(item)}" if File.directory?(item) return Dir.glob(pattern) else return [item] end end |