Class: HwCheker::HomeWorkChecker::FileScan
- Inherits:
-
Object
- Object
- HwCheker::HomeWorkChecker::FileScan
- Defined in:
- lib/hw_cheker/file_scan.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(work_path) ⇒ FileScan
constructor
A new instance of FileScan.
Constructor Details
#initialize(work_path) ⇒ FileScan
Returns a new instance of FileScan.
5 6 7 8 9 10 11 12 |
# File 'lib/hw_cheker/file_scan.rb', line 5 def initialize(work_path) @work_path, @files = work_path, [] Dir::foreach(@work_path) do |p| if File::file?("#{@work_path}/#{p}") && FILE_TYPES.include?(File::extname p) && !exist_xml?(p) @files << p end end end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
4 5 6 |
# File 'lib/hw_cheker/file_scan.rb', line 4 def files @files end |
Instance Method Details
#each ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hw_cheker/file_scan.rb', line 14 def each if block_given? i = 0 while i < @files.size type = File::extname(@files[i]) name = @files[i].chomp(type) yield(name, type) i += 1 end end @files end |