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.
28 29 30 |
# File 'lib/aspera/cli/plugins/node.rb', line 28 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
33 34 35 |
# File 'lib/aspera/cli/plugins/node.rb', line 33 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
38 39 40 |
# File 'lib/aspera/cli/plugins/node.rb', line 38 def add_to_paths!(path_args) path_args.map!{ |p| add_to_path(p)} end |
#remove_in_object_list!(obj_list) ⇒ Object
42 43 44 45 46 |
# File 'lib/aspera/cli/plugins/node.rb', line 42 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 |