Module: VCDry::Core
Instance Method Summary collapse
Instance Method Details
#vcdry_parse_keywords(kwargs = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vcdry/core.rb', line 12 def vcdry_parse_keywords(kwargs = {}) kwargs = kwargs.symbolize_keys self.class.vcdry.keyword_configs.each do |config| if config.required? && !kwargs.key?(config.name) raise MissingRequiredKeywordError.new(config.name) end value = kwargs.fetch(config.name, config.default) instance_variable_set(config.instance_variable, config.type_cast(value)) end kwargs.except(*self.class.vcdry.keywords) end |