Module: RVC::InventoryObject
- Included in:
- FakeFolder, RootNode, RbVmomi::VIM, RbVmomi::VIM::Datastore::FakeDatastoreFile, RbVmomi::VIM::Datastore::FakeDatastoreFolder, RbVmomi::VIM::ManagedEntity
- Defined in:
- lib/rvc/inventory.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#rvc_arc ⇒ Object
readonly
Returns the value of attribute rvc_arc.
-
#rvc_parent ⇒ Object
readonly
Returns the value of attribute rvc_parent.
Class Method Summary collapse
Instance Method Summary collapse
- #children ⇒ Object
- #display_info ⇒ Object
- #ls_text(r) ⇒ Object
- #rvc_link(parent, arc) ⇒ Object
- #rvc_path ⇒ Object
- #rvc_path_str ⇒ Object
- #traverse_one(arc) ⇒ Object
Instance Attribute Details
#rvc_arc ⇒ Object (readonly)
Returns the value of attribute rvc_arc.
38 39 40 |
# File 'lib/rvc/inventory.rb', line 38 def rvc_arc @rvc_arc end |
#rvc_parent ⇒ Object (readonly)
Returns the value of attribute rvc_parent.
38 39 40 |
# File 'lib/rvc/inventory.rb', line 38 def rvc_parent @rvc_parent end |
Class Method Details
.included(m) ⇒ Object
34 35 36 |
# File 'lib/rvc/inventory.rb', line 34 def self.included m m.extend ClassMethods end |
Instance Method Details
#children ⇒ Object
52 53 54 |
# File 'lib/rvc/inventory.rb', line 52 def children {} end |
#display_info ⇒ Object
40 41 42 |
# File 'lib/rvc/inventory.rb', line 40 def display_info puts "class: #{self.class.name}" end |
#ls_text(r) ⇒ Object
44 45 46 |
# File 'lib/rvc/inventory.rb', line 44 def ls_text r self.class.folder? ? '/' : '' end |
#rvc_link(parent, arc) ⇒ Object
71 72 73 74 75 |
# File 'lib/rvc/inventory.rb', line 71 def rvc_link parent, arc return if @rvc_parent @rvc_parent = parent @rvc_arc = arc end |
#rvc_path ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rvc/inventory.rb', line 56 def rvc_path [].tap do |a| cur = self while cur != nil a << [cur.rvc_arc, cur] cur = cur.rvc_parent end a.reverse! end end |
#rvc_path_str ⇒ Object
67 68 69 |
# File 'lib/rvc/inventory.rb', line 67 def rvc_path_str rvc_path.map { |k,v| k } * '/' end |
#traverse_one(arc) ⇒ Object
48 49 50 |
# File 'lib/rvc/inventory.rb', line 48 def traverse_one arc children[arc] end |