Class: Vagrant::Vagrantfile::ConfigWrapper
- Inherits:
-
Object
- Object
- Vagrant::Vagrantfile::ConfigWrapper
- Defined in:
- lib/vagrant/vagrantfile/remote.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ ConfigWrapper
constructor
A new instance of ConfigWrapper.
- #method_missing(*args, **opts, &block) ⇒ Object
Constructor Details
#initialize(client:) ⇒ ConfigWrapper
Returns a new instance of ConfigWrapper.
37 38 39 40 41 |
# File 'lib/vagrant/vagrantfile/remote.rb', line 37 def initialize(client:) @client = client @logger = Log4r::Logger.new(self.class.name.downcase) @root = Vagrant::Config::V2::Root.new(Vagrant.plugin("2").local_manager.config) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, **opts, &block) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/vagrant/vagrantfile/remote.rb', line 43 def method_missing(*args, **opts, &block) case args.size when 1 namespace = args.first ConfigFetcher.new(namespace, client: @client) when 2 if args.first.to_s != "[]" raise ArgumentError, "Expected #[] but received ##{args.first} on config wrapper" end namespace = args.last ConfigFetcher.new(namespace, client: @client) else @logger.trace("cannot handle wrapped config request for #{args.inspect}, sending to root") @root.send(*args, **opts, &block) end end |