Class: Aspera::Cli::Plugins::Node::NodePathPrefix
- Inherits:
-
Object
- Object
- Aspera::Cli::Plugins::Node::NodePathPrefix
- Defined in:
- lib/aspera/cli/plugins/node.rb
Overview
Processing of paths in arguments and results Used only by Faspex4 to browse packages
Instance Method Summary collapse
-
#add_to_path(path_arg) ⇒ Object
get next path argument from command line, and add prefix.
-
#add_to_paths!(path_args) ⇒ Object
get remaining path arguments from command line, and add prefix.
-
#initialize(path) ⇒ NodePathPrefix
constructor
A new instance of NodePathPrefix.
- #remove_in_object_list!(obj_list) ⇒ Object
Constructor Details
#initialize(path) ⇒ NodePathPrefix
Returns a new instance of NodePathPrefix.
27 28 29 |
# File 'lib/aspera/cli/plugins/node.rb', line 27 def initialize(path) @root = path end |
Instance Method Details
#add_to_path(path_arg) ⇒ Object
get next path argument from command line, and add prefix
32 33 34 |
# File 'lib/aspera/cli/plugins/node.rb', line 32 def add_to_path(path_arg) File.join(@root, path_arg) end |
#add_to_paths!(path_args) ⇒ Object
get remaining path arguments from command line, and add prefix
37 38 39 |
# File 'lib/aspera/cli/plugins/node.rb', line 37 def add_to_paths!(path_args) path_args.map!{ |p| add_to_path(p)} end |
#remove_in_object_list!(obj_list) ⇒ Object
41 42 43 44 45 |
# File 'lib/aspera/cli/plugins/node.rb', line 41 def remove_in_object_list!(obj_list) obj_list.each do |item| item['path'] = item['path'][@root.length..-1] if item['path'].start_with?(@root) end end |