Class: VagrantPlugins::AVF::Model::SharedDirectory
- Inherits:
-
Object
- Object
- VagrantPlugins::AVF::Model::SharedDirectory
- Defined in:
- lib/vagrant_provider_avf/model/shared_directory.rb
Constant Summary collapse
- DEVICE_TAG =
"avfshare".freeze
Instance Attribute Summary collapse
-
#guest_path ⇒ Object
readonly
Returns the value of attribute guest_path.
-
#host_path ⇒ Object
readonly
Returns the value of attribute host_path.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, host_path:, guest_path:, name: nil) ⇒ SharedDirectory
constructor
A new instance of SharedDirectory.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, host_path:, guest_path:, name: nil) ⇒ SharedDirectory
Returns a new instance of SharedDirectory.
11 12 13 14 15 16 |
# File 'lib/vagrant_provider_avf/model/shared_directory.rb', line 11 def initialize(id:, host_path:, guest_path:, name: nil) @id = id.to_s @host_path = host_path.to_s @guest_path = guest_path.to_s @name = name || self.class.name_for(id) end |
Instance Attribute Details
#guest_path ⇒ Object (readonly)
Returns the value of attribute guest_path.
9 10 11 |
# File 'lib/vagrant_provider_avf/model/shared_directory.rb', line 9 def guest_path @guest_path end |
#host_path ⇒ Object (readonly)
Returns the value of attribute host_path.
9 10 11 |
# File 'lib/vagrant_provider_avf/model/shared_directory.rb', line 9 def host_path @host_path end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/vagrant_provider_avf/model/shared_directory.rb', line 9 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/vagrant_provider_avf/model/shared_directory.rb', line 9 def name @name end |
Class Method Details
.name_for(id) ⇒ Object
26 27 28 |
# File 'lib/vagrant_provider_avf/model/shared_directory.rb', line 26 def self.name_for(id) "share-#{Digest::SHA256.hexdigest(id.to_s)[0, 12]}" end |
Instance Method Details
#to_h ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/vagrant_provider_avf/model/shared_directory.rb', line 18 def to_h { "hostPath" => @host_path, "name" => @name, "readOnly" => false } end |