Class: Vagrant::Boxen::OptionsEvaluator
- Inherits:
-
Object
- Object
- Vagrant::Boxen::OptionsEvaluator
- Defined in:
- lib/vagrant-boxen/options_evaluator.rb
Overview
TODO: Write specs ;)
Instance Method Summary collapse
-
#initialize(allowed_options, &block) ⇒ OptionsEvaluator
constructor
A new instance of OptionsEvaluator.
- #method_missing(method, *args) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(allowed_options, &block) ⇒ OptionsEvaluator
Returns a new instance of OptionsEvaluator.
4 5 6 7 8 |
# File 'lib/vagrant-boxen/options_evaluator.rb', line 4 def initialize(, &block) @allowed_options = @block = block @hash = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/vagrant-boxen/options_evaluator.rb', line 10 def method_missing(method, *args) if @allowed_options.include?(method) @hash[method] = args.first else super end end |
Instance Method Details
#to_hash ⇒ Object
18 19 20 21 |
# File 'lib/vagrant-boxen/options_evaluator.rb', line 18 def to_hash instance_eval(&@block) @hash end |