Method: CloudDrive::Node#build_node_path
- Defined in:
- lib/clouddrive/node.rb
#build_node_path(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/clouddrive/node.rb', line 15 def build_node_path(node) path = [] loop do path.push node["name"] break if node.has_key?('isRoot') && node['isRoot'] == true results = find_by_id(node["parents"][0]) if results[:success] == false raise "No parent node found with ID #{node["parents"][0]}" end node = results[:data] break if node.has_key?('isRoot') && node['isRoot'] === true end path = path.reverse path.join('/') end |