class VagrantPlugins::Registration::Config
Attributes
conf[R]
Public Class Methods
new(region_specific=false)
click to toggle source
# File lib/vagrant-registration/config.rb, line 9 def initialize(region_specific=false) @conf = UNSET_VALUE @logger = Log4r::Logger.new('vagrant_registration::config') end
Public Instance Methods
finalize!()
click to toggle source
# File lib/vagrant-registration/config.rb, line 14 def finalize! get_config @conf.skip = false unless @conf.skip # Unregister on halt by default @conf.unregister_on_halt = true if @conf.unregister_on_halt.nil? @logger.info "Final registration configuration: #{@conf.inspect}" end
method_missing(method_sym, *arguments, &block)
click to toggle source
# File lib/vagrant-registration/config.rb, line 22 def method_missing(method_sym, *arguments, &block) get_config command = "@conf.#{method_sym} #{adjust_arguments(arguments)}" @logger.info "Evaluating registration configuration: #{command}" eval command end
Private Instance Methods
adjust_arguments(args)
click to toggle source
Serialize strings, nil and boolean values, symbols, arrays and hashes to be used within eval()
# File lib/vagrant-registration/config.rb, line 39 def adjust_arguments(args) return '' if args.size < 1 args.inspect[1..-2] end
get_config()
click to toggle source
Don't set @conf to OpenStruct in initialize to preserve config hierarchy
# File lib/vagrant-registration/config.rb, line 33 def get_config @conf = OpenStruct.new if @conf == UNSET_VALUE end