Class: VagrantPlugins::Unison::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Unison::Config
- Defined in:
- lib/vagrant-unison-morroni/config.rb
Instance Attribute Summary collapse
-
#guest_folder ⇒ String
Guest Folder to Sync.
-
#host_folder ⇒ String
Host Folder to Sync.
-
#ignore ⇒ String
Pattern of files to ignore.
-
#repeat ⇒ String
Repeat speed.
Instance Method Summary collapse
-
#finalize! ⇒ Object
def merge(other) super.tap do |result| # TODO - do something sensible; current last config wins result.local_folder = other.local_folder result.remote_folder = other.remote_folder end end.
-
#initialize(region_specific = false) ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize(region_specific = false) ⇒ Config
Returns a new instance of Config.
26 27 28 29 30 31 |
# File 'lib/vagrant-unison-morroni/config.rb', line 26 def initialize(region_specific=false) @host_folder = UNSET_VALUE @remote_folder = UNSET_VALUE @ignore = UNSET_VALUE @repeat = UNSET_VALUE end |
Instance Attribute Details
#guest_folder ⇒ String
Guest Folder to Sync.
14 15 16 |
# File 'lib/vagrant-unison-morroni/config.rb', line 14 def guest_folder @guest_folder end |
#host_folder ⇒ String
Host Folder to Sync
9 10 11 |
# File 'lib/vagrant-unison-morroni/config.rb', line 9 def host_folder @host_folder end |
#ignore ⇒ String
Pattern of files to ignore.
19 20 21 |
# File 'lib/vagrant-unison-morroni/config.rb', line 19 def ignore @ignore end |
#repeat ⇒ String
Repeat speed.
24 25 26 |
# File 'lib/vagrant-unison-morroni/config.rb', line 24 def repeat @repeat end |
Instance Method Details
#finalize! ⇒ Object
def merge(other)
super.tap do |result|
# TODO - do something sensible; current last config wins
result.local_folder = other.local_folder
result.remote_folder = other.remote_folder
end
end
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/vagrant-unison-morroni/config.rb', line 45 def finalize! # The access keys default to nil @host_folder = nil if @host_folder == UNSET_VALUE @guest_folder = nil if @guest_folder == UNSET_VALUE @ignore = nil if @ignore == UNSET_VALUE @repeat = 1 if @repeat == UNSET_VALUE # Mark that we finalized @__finalized = true end |
#validate(machine) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/vagrant-unison-morroni/config.rb', line 56 def validate(machine) errors = [] #errors << I18n.t("vagrant_sync.config.host_folder_required") if @host_folder.nil? #errors << I18n.t("vagrant_sync.config.guest_folder_required") if @guest_folder.nil? { "Unison" => errors } end |