Class: Dsu::Migration::RawJsonFiles
- Inherits:
-
Object
- Object
- Dsu::Migration::RawJsonFiles
- Defined in:
- lib/dsu/migration/raw_json_files.rb
Instance Attribute Summary collapse
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
Class Method Summary collapse
Instance Method Summary collapse
- #each_file(regex: //) ⇒ Object
- #folder_exist? ⇒ Boolean
-
#initialize(folder) ⇒ RawJsonFiles
constructor
A new instance of RawJsonFiles.
Constructor Details
#initialize(folder) ⇒ RawJsonFiles
Returns a new instance of RawJsonFiles.
13 14 15 |
# File 'lib/dsu/migration/raw_json_files.rb', line 13 def initialize(folder) @folder = folder end |
Instance Attribute Details
#folder ⇒ Object
Returns the value of attribute folder.
11 12 13 |
# File 'lib/dsu/migration/raw_json_files.rb', line 11 def folder @folder end |
Class Method Details
.folder_exist?(folder:) ⇒ Boolean
32 33 34 |
# File 'lib/dsu/migration/raw_json_files.rb', line 32 def folder_exist?(folder:) Dir.exist?(folder) end |
Instance Method Details
#each_file(regex: //) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/dsu/migration/raw_json_files.rb', line 17 def each_file(regex: //) return unless folder_exist? Pathname.new(folder).children.each do |child| next unless child.file? && child.to_s.match?(regex) yield RawJsonFile.new(child) end end |
#folder_exist? ⇒ Boolean
27 28 29 |
# File 'lib/dsu/migration/raw_json_files.rb', line 27 def folder_exist? self.class.folder_exist?(folder: folder) end |