Class: KDomain::DomainModel::HasOne
- Inherits:
-
Object
- Object
- KDomain::DomainModel::HasOne
- Defined in:
- lib/k_domain/schemas/domain/old/has_one.rb
Constant Summary collapse
- KEYS =
KEYS = [:model_name, :model_name_plural, :a_lambda, :class_name, :foreign_key, :primary_key, :infer_key]
%i[a_lambda class_name foreign_key primary_key infer_key code_duplicate].freeze
Instance Attribute Summary collapse
-
#a_lambda ⇒ Object
Returns the value of attribute a_lambda.
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#code_duplicate ⇒ Object
Returns the value of attribute code_duplicate.
-
#foreign_key ⇒ Object
Returns the value of attribute foreign_key.
-
#model_name ⇒ Object
Returns the value of attribute model_name.
-
#model_name_plural ⇒ Object
Returns the value of attribute model_name_plural.
-
#name ⇒ Object
Returns the value of attribute name.
-
#primary_key ⇒ Object
Returns the value of attribute primary_key.
-
#related_entity ⇒ Object
Returns the value of attribute related_entity.
Instance Method Summary collapse
Instance Attribute Details
#a_lambda ⇒ Object
Returns the value of attribute a_lambda.
14 15 16 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 14 def a_lambda @a_lambda end |
#class_name ⇒ Object
Returns the value of attribute class_name.
15 16 17 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 15 def class_name @class_name end |
#code_duplicate ⇒ Object
Returns the value of attribute code_duplicate.
24 25 26 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 24 def code_duplicate @code_duplicate end |
#foreign_key ⇒ Object
Returns the value of attribute foreign_key.
16 17 18 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 16 def foreign_key @foreign_key end |
#model_name ⇒ Object
Returns the value of attribute model_name.
11 12 13 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 11 def model_name @model_name end |
#model_name_plural ⇒ Object
Returns the value of attribute model_name_plural.
12 13 14 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 12 def model_name_plural @model_name_plural end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 9 def name @name end |
#primary_key ⇒ Object
Returns the value of attribute primary_key.
17 18 19 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 17 def primary_key @primary_key end |
#related_entity ⇒ Object
Returns the value of attribute related_entity.
23 24 25 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 23 def @related_entity end |
Instance Method Details
#infer_key ⇒ Object
19 20 21 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 19 def infer_key primary_key.nil? ? "#{name}_id" : primary_key end |
#to_h ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/k_domain/schemas/domain/old/has_one.rb', line 26 def to_h { name: name, model_name: model_name, model_name_plural: model_name_plural, a_lambda: a_lambda, class_name: class_name, foreign_key: foreign_key, primary_key: primary_key, code_duplicate: code_duplicate, related_entity: .to_h } end |