Sha256: 174c807f1e23f1563dcc5796ef289c9ec621213eb849092a4a44850b5cdf74cd

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

module Vagrant::Boxen
  # TODO: Write specs ;)
  class OptionsEvaluator
    def initialize(allowed_options, &block)
      @allowed_options = allowed_options
      @block           = block
      @hash            = {}
    end

    def method_missing(method, *args)
      if @allowed_options.include?(method)
        @hash[method] = args.first
      else
        super
      end
    end

    def to_hash
      instance_eval(&@block)
      @hash
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-boxen-0.0.4 lib/vagrant-boxen/options_evaluator.rb
vagrant-boxen-0.0.3 lib/vagrant-boxen/options_evaluator.rb