Skip to content
Snippets Groups Projects
Commit 44232ab0 authored by Markus Reiter's avatar Markus Reiter Committed by GitHub
Browse files

Merge pull request #2519 from reitermarkus/validate-container-type

Validate `container :type`.
parents 17720880 1e06d131
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ module Hbc
begin
const_get(type.to_s.split("_").map(&:capitalize).join)
rescue NameError
false
nil
end
end
end
......
require "hbc/container"
module Hbc
class DSL
class Container
......@@ -13,9 +15,12 @@ module Hbc
@pairs = pairs
pairs.each do |key, value|
raise "invalid container key: '#{key.inspect}'" unless VALID_KEYS.include?(key)
writer_method = "#{key}=".to_sym
send(writer_method, value)
send(:"#{key}=", value)
end
return if type.nil?
return unless Hbc::Container.from_type(type).nil?
raise "invalid container type: #{type.inspect}"
end
def to_yaml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment