Sha256: 5979971f03634ce3b4e8da508f7b34e32a9c92d7e0708f081dd43bd475ec6f35
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
# frozen_string_literal: true require 'ostruct' module GlobalRegistry #:nodoc: module Bindings #:nodoc: module Options class ClassOptions delegate :id_column, :mdm_id_column, :mdm_timeout, :type, :push_on, :parent_association, :parent_association_class, :related_association, :related_association_class, :parent_relationship_name, :related_relationship_name, :exclude_fields, :extra_fields, to: :@options def initialize(model_class) @model_class = model_class @options = OpenStruct.new model_class._global_registry_bindings_options_hash end def parent_class return if parent_association.blank? return parent_association_class if parent_association_class.present? @model_class.reflect_on_all_associations .detect { |a| a.name == parent_association.to_sym } &.klass end def related_class return if related_association.blank? return related_association_class if related_association_class.present? @model_class.reflect_on_all_associations .detect { |a| a.name == related_association.to_sym } &.klass end def parent_is_self? parent_association.present? && parent_type == type end def parent_type parent_class&.global_registry&.type end def related_type related_class&.global_registry&.type end def mdm_worker_class_name "Pull#{@model_class.name.tr(':', '')}MdmIdWorker" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
global-registry-bindings-0.0.6 | lib/global_registry_bindings/options/class_options.rb |