lib/scrivito/attribute_definition.rb in scrivito_sdk-0.71.2 vs lib/scrivito/attribute_definition.rb in scrivito_sdk-0.90.0.rc1

- old
+ new

@@ -17,10 +17,11 @@ # attr_reader :name, :type def initialize(name, type, options = {}) @name, @type, @options = name.to_s, type.to_s, options.with_indifferent_access + assert_valid_options end # # Allowed values for an attribute. # @@ -36,9 +37,17 @@ end end def widgetlist? type == 'widgetlist' + end + + private + + def assert_valid_options + if (values = @options[:values]) && values.include?('') + raise ScrivitoError, %{Empty string is not allowed as value for #{type} attribute "#{name}".} + end end end end