Class: KDomain::DomainModel::RelatedEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/k_domain/schemas/domain/old/related_entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity) ⇒ RelatedEntity

Returns a new instance of RelatedEntity.



15
16
17
18
19
20
21
22
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 15

def initialize(entity)
  @name        = entity.name
  @name_plural = entity.name_plural
  @main_key    = entity.main_key
  @trait1      = entity.trait1
  @trait2      = entity.trait2
  @trait3      = entity.trait3
end

Instance Attribute Details

#main_keyObject

Returns the value of attribute main_key.



9
10
11
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 9

def main_key
  @main_key
end

#nameObject

Name of the entity model



7
8
9
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 7

def name
  @name
end

#name_pluralObject

Returns the value of attribute name_plural.



8
9
10
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 8

def name_plural
  @name_plural
end

#trait1Object

Returns the value of attribute trait1.



11
12
13
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 11

def trait1
  @trait1
end

#trait2Object

Returns the value of attribute trait2.



12
13
14
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 12

def trait2
  @trait2
end

#trait3Object

Returns the value of attribute trait3.



13
14
15
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 13

def trait3
  @trait3
end

Instance Method Details

#to_hObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/k_domain/schemas/domain/old/related_entity.rb', line 24

def to_h
  {
    name: name,
    name_plural: name_plural,
    main_key: main_key,
    trait1: trait1,
    trait2: trait2,
    trait3: trait3
  }
end