Sha256: 014dccff8cbf0331540b1b39bfd015b8cf5a95954a367f6fac1d9804224c8b03
Contents?: true
Size: 903 Bytes
Versions: 11
Compression:
Stored size: 903 Bytes
Contents
module Scrivito # # This class represents a definition of an attribute. # # @api public # class AttributeDefinition # # @!attribute [r] name # @api public # @return [String] the name of the attribute. # # @!attribute [r] type # @api public # @return [String] the type of the attribute. # attr_reader :name, :type def initialize(name, type, options = {}) @name, @type, @options = name.to_s, type.to_s, options.with_indifferent_access end # # Allowed values for an attribute. # # @api public # @return [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. # def values if type == 'enum' || type == 'multienum' @options[:values] || [] else [] end end def widgetlist? type == 'widgetlist' end end end
Version data entries
11 entries across 11 versions & 1 rubygems