Class: Neutron::FileList

Inherits:
Array
  • Object
show all
Defined in:
lib/neutron.rb

Overview

Polyfill for Rake::FileList

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](filter) ⇒ Neutron::FileList

Selects all files which match given pattern/regex

Parameters:

  • filter (String, Regexp)

Returns:


16
17
18
19
20
21
22
# File 'lib/neutron.rb', line 16

def self.[](filter)
  arr = Dir[filter]
  arr = arr.keep_if do |f|
    File.file? f
  end
  self.new(arr)
end

Instance Method Details

#ext(ext) ⇒ Object

Switches all files to given extension

Parameters:

  • ext (String)

    New extension


26
27
28
29
30
# File 'lib/neutron.rb', line 26

def ext(ext)
  self.map do |f|
    Neutron.file_to_ext(f, ext)
  end
end