Class: Yes::Core::Aggregate::Dsl::AttributeData

Inherits:
Object
  • Object
show all
Defined in:
lib/yes/core/aggregate/dsl/attribute_data.rb

Overview

Data object that holds information about an attribute definition in an aggregate

Examples:

AttributeData.new(:name, :string, MyAggregate, context: 'users', aggregate: 'user')

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, aggregate_class, options = {}) ⇒ AttributeData

Returns a new instance of AttributeData.

Parameters:

  • name (Symbol)

    The name of the attribute

  • type (Symbol)

    The type of the attribute

  • aggregate_class (Class)

    The aggregate class this attribute belongs to

  • options (Hash) (defaults to: {})

    Additional options for the attribute

Options Hash (options):

  • :context (String)

    The context name for the attribute

  • :aggregate (String)

    The aggregate name

  • :localized (Boolean)

    Whether the attribute is localized

  • :encrypted (Boolean)

    Whether the attribute should be encrypted

Since:

  • 0.1.0



24
25
26
27
28
29
30
31
32
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 24

def initialize(name, type, aggregate_class, options = {})
  @name = name
  @type = type
  @aggregate_class = aggregate_class
  @context_name = options.delete(:context)
  @aggregate_name = options.delete(:aggregate)
  @localized = options.delete(:localized) || false
  @encrypted = options.delete(:encrypted) || false
end

Instance Attribute Details

#aggregate_classObject (readonly)

Since:

  • 0.1.0



13
14
15
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 13

def aggregate_class
  @aggregate_class
end

#aggregate_nameObject (readonly)

Since:

  • 0.1.0



13
14
15
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 13

def aggregate_name
  @aggregate_name
end

#context_nameObject (readonly)

Since:

  • 0.1.0



13
14
15
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 13

def context_name
  @context_name
end

#encryptedObject (readonly)

Since:

  • 0.1.0



13
14
15
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 13

def encrypted
  @encrypted
end

#localizedObject (readonly)

Since:

  • 0.1.0



13
14
15
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 13

def localized
  @localized
end

#nameObject (readonly)

Since:

  • 0.1.0



13
14
15
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 13

def name
  @name
end

#typeObject (readonly)

Since:

  • 0.1.0



13
14
15
# File 'lib/yes/core/aggregate/dsl/attribute_data.rb', line 13

def type
  @type
end