Class: VagrantPlugins::Registration::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Registration::Config
- Defined in:
- lib/vagrant-registration/config.rb
Instance Attribute Summary collapse
-
#conf ⇒ Object
readonly
Returns the value of attribute conf.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize(region_specific = false) ⇒ Config
constructor
A new instance of Config.
- #method_missing(method_sym, *arguments, &block) ⇒ Object
Constructor Details
#initialize(region_specific = false) ⇒ Config
Returns a new instance of Config.
9 10 11 12 |
# File 'lib/vagrant-registration/config.rb', line 9 def initialize(region_specific=false) @conf = UNSET_VALUE @logger = Log4r::Logger.new('vagrant_registration::config') end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
22 23 24 25 26 27 |
# 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 I18n.t('registration.config.method_missing_command', command: command) eval command end |
Instance Attribute Details
#conf ⇒ Object (readonly)
Returns the value of attribute conf.
7 8 9 |
# File 'lib/vagrant-registration/config.rb', line 7 def conf @conf end |
Instance Method Details
#finalize! ⇒ Object
14 15 16 17 18 19 20 |
# 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 I18n.t('registration.config.final_message', conf: @conf.inspect) end |