lib/scrivito/attribute_definition.rb in scrivito_sdk-1.0.0 vs lib/scrivito/attribute_definition.rb in scrivito_sdk-1.1.0.rc1

- old
+ new

@@ -42,10 +42,22 @@ end private def assert_valid_options - if (values = @options[:values]) && values.include?('') + @options.assert_valid_keys(:values, 'values') + if values = @options[:values] + values.each(&method(:assert_valid_value)) + end + end + + def assert_valid_value(value) + unless value.is_a?(String) + raise ScrivitoError, + %{#{value.class} is not allowed as value for #{type} attribute "#{name}".} + end + + if value == '' raise ScrivitoError, %{Empty string is not allowed as value for #{type} attribute "#{name}".} end end end