Class: Etna::Clients::Metis::WalkMetisWorkflow
- Inherits:
-
Struct
- Object
- Struct
- Etna::Clients::Metis::WalkMetisWorkflow
- Defined in:
- lib/etna/clients/metis/workflows/walk_metis_workflow.rb
Instance Attribute Summary collapse
-
#bucket_name ⇒ Object
Returns the value of attribute bucket_name.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#metis_client ⇒ Object
Returns the value of attribute metis_client.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#root_dir ⇒ Object
Returns the value of attribute root_dir.
Instance Method Summary collapse
Instance Attribute Details
#bucket_name ⇒ Object
Returns the value of attribute bucket_name
4 5 6 |
# File 'lib/etna/clients/metis/workflows/walk_metis_workflow.rb', line 4 def bucket_name @bucket_name end |
#logger ⇒ Object
Returns the value of attribute logger
4 5 6 |
# File 'lib/etna/clients/metis/workflows/walk_metis_workflow.rb', line 4 def logger @logger end |
#metis_client ⇒ Object
Returns the value of attribute metis_client
4 5 6 |
# File 'lib/etna/clients/metis/workflows/walk_metis_workflow.rb', line 4 def metis_client @metis_client end |
#project_name ⇒ Object
Returns the value of attribute project_name
4 5 6 |
# File 'lib/etna/clients/metis/workflows/walk_metis_workflow.rb', line 4 def project_name @project_name end |
#root_dir ⇒ Object
Returns the value of attribute root_dir
4 5 6 |
# File 'lib/etna/clients/metis/workflows/walk_metis_workflow.rb', line 4 def root_dir @root_dir end |
Instance Method Details
#each(&block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/etna/clients/metis/workflows/walk_metis_workflow.rb', line 6 def each(&block) q = [self.root_dir] while (n = q.pop) req = Etna::Clients::Metis::ListFolderRequest.new( project_name: project_name, bucket_name: bucket_name, folder_path: n ) next unless metis_client.folder_exists?(req) resp = metis_client.list_folder(req) resp.files.all.sort_by { |f| f.file_path[self.root_dir.length..-1] }.each do |file| yield [file, file.file_path[self.root_dir.length..-1]] end resp.folders.all.sort_by { |f| f.folder_path[self.root_dir.length..-1] }.each do |f| yield [f, f.folder_path[self.root_dir.length..-1]] q << f.folder_path end end end |