Class: FileSet
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
- #each ⇒ Object
- #include_file(file) ⇒ Object
-
#initialize(set) ⇒ FileSet
constructor
A new instance of FileSet.
Constructor Details
#initialize(set) ⇒ FileSet
Returns a new instance of FileSet.
7 8 9 10 11 12 13 14 15 |
# File 'lib/file-set.rb', line 7 def initialize(set) @files= [] case when (set.is_a?(String)) include_file(set) when (set.is_a?(Array)) set.each { |f| include_file(f) } end end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
5 6 7 |
# File 'lib/file-set.rb', line 5 def files @files end |
Instance Method Details
#each ⇒ Object
38 39 40 |
# File 'lib/file-set.rb', line 38 def each @files.each { |f| yield f } end |
#include_file(file) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/file-set.rb', line 17 def include_file(file) full_path= File.(file) if File.directory?(full_path) Dir.foreach(full_path) { |f| next if ('.'==f[/^\./]) include_file(File.join(full_path, f)) } else if (File.exists?(full_path)) source_file= SourceFile.from_path(full_path) else source_file= Target.current.find_file(file) return if (!source_file) end return if (@files.include?(source_file)) @files << source_file end end |