Class: UniverseCompiler::Entity::Base
- Inherits:
-
Object
- Object
- UniverseCompiler::Entity::Base
- Extended by:
- AutoNamed, FieldBinder, FieldConstraintManagement, RelationsManagement
- Includes:
- Conversion, FieldManagement, Inheritance, Marshalling, Overridden, Persistence, TypeManagement, Validation, Utils::DeepTraverse, Utils::ErrorPropagation
- Defined in:
- lib/universe_compiler/entity.rb
Direct Known Subclasses
Constant Summary
Constants included from FieldConstraintManagement
FieldConstraintManagement::BOOLEAN_CONSTRAINTS, FieldConstraintManagement::INCOMPATIBLE_CONSTRAINTS, FieldConstraintManagement::PARAMETRIZED_CONSTRAINTS
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#universe ⇒ Object
Returns the value of attribute universe.
Attributes included from AutoNamed
Attributes included from Persistence
Attributes included from Inheritance
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(fields: {}, universe: nil) ⇒ Base
constructor
A new instance of Base.
Methods included from AutoNamed
auto_named_entity_type, auto_named_entity_type?, get_unique_name
Methods included from FieldConstraintManagement
define_constraint, field, fields_constraints
Methods included from RelationsManagement
Methods included from FieldBinder
field_accessor, field_reader, field_writer
Methods included from Persistence
Methods included from Overridden
#apply_override, #overridden_by
Methods included from Conversion
#==, #as_path, #encode_with, #eql?, #init_with, #inspect, #to_composite_key, #to_hash, #to_reference, #to_uniq_id
Methods included from Inheritance
#apply_inheritance, #valid_for_inheritance?
Methods included from Marshalling
#dereferenced_fields, #fully_resolved?, #resolve_fields_references, #resolve_fields_references!, #traverse_fields
Methods included from Validation
#invalid_fields, #valid?, #valid_for_fields_constraints?
Methods included from TypeManagement
extended, included, #type, type_class_mapping, types_classes_mapping, valid_for_type?
Methods included from Utils::DeepTraverse
Constructor Details
#initialize(fields: {}, universe: nil) ⇒ Base
Returns a new instance of Base.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/universe_compiler/entity.rb', line 25 def initialize(fields: {}, universe: nil) @fields = fields define_known_fields_accessors define_reverse_methods self.universe = universe self.fully_resolved = true if universe.nil? self.name = self.class.get_unique_name(nil) if self.class.auto_named_entity_type? else unless universe.compiled? self.name = self.class.get_unique_name(universe) if self.class.auto_named_entity_type? end end end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
21 22 23 |
# File 'lib/universe_compiler/entity.rb', line 21 def fields @fields end |
#universe ⇒ Object
Returns the value of attribute universe.
21 22 23 |
# File 'lib/universe_compiler/entity.rb', line 21 def universe @universe end |
Instance Method Details
#[](key) ⇒ Object
49 50 51 |
# File 'lib/universe_compiler/entity.rb', line 49 def [](key) fields[key] end |
#[]=(key, value) ⇒ Object
53 54 55 |
# File 'lib/universe_compiler/entity.rb', line 53 def []=(key, value) fields[key] = value end |