Class: Scrivito::AttributeDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/scrivito/attribute_definition.rb

Overview

This class represents a definition of an attribute.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameString (readonly)

Returns the name of the attribute.

Returns:

  • (String)

    the name of the attribute.



18
19
20
# File 'lib/scrivito/attribute_definition.rb', line 18

def name
  @name
end

Instance Method Details

#valuesArray<String>

Allowed values for an attribute.

Returns:

  • (Array<String>)

    allowed values if type is enum or multienum or an empty array otherwise. If no values have been specified, then an empty array will be returned.



31
32
33
34
35
36
37
# File 'lib/scrivito/attribute_definition.rb', line 31

def values
  if type == 'enum' || type == 'multienum'
    @options[:values] || []
  else
    []
  end
end