Class: GlobalRegistry::Bindings::Options::RelationshipOptionsParser
- Inherits:
-
Object
- Object
- GlobalRegistry::Bindings::Options::RelationshipOptionsParser
- Defined in:
- lib/global_registry_bindings/options/relationship_options_parser.rb
Instance Method Summary collapse
- #defaults ⇒ Object
-
#initialize(model_class) ⇒ RelationshipOptionsParser
constructor
A new instance of RelationshipOptionsParser.
- #parse(options_hash = {}) ⇒ Object
Constructor Details
#initialize(model_class) ⇒ RelationshipOptionsParser
Returns a new instance of RelationshipOptionsParser.
7 8 9 |
# File 'lib/global_registry_bindings/options/relationship_options_parser.rb', line 7 def initialize(model_class) @model_class = model_class end |
Instance Method Details
#defaults ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/global_registry_bindings/options/relationship_options_parser.rb', line 11 def defaults { binding: :relationship, id_column: :global_registry_id, type: @model_class.name.demodulize.underscore.to_sym, client_integration_id: :id, primary_binding: :entity, primary: nil, primary_class: nil, primary_name: nil, primary_foreign_key: nil, related: nil, related_class: nil, related_type: nil, related_name: nil, related_foreign_key: nil, related_global_registry_id: nil, related_binding: :entity, exclude: %i[id created_at updated_at], include_all_columns: false, fields: {}, ensure_type: true, rename_entity_type: true, if: nil, unless: nil }.freeze end |
#parse(options_hash = {}) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/global_registry_bindings/options/relationship_options_parser.rb', line 24 def parse( = {}) merge_defaults() update_association_classes update_foreign_keys update_excludes @options end |