Class: Dionysus::Producer::Registry::Registration::Topic::ModelRegistration

Inherits:
Object
  • Object
show all
Defined in:
lib/dionysus/producer/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_klass, options = {}) ⇒ ModelRegistration

Returns a new instance of ModelRegistration.



89
90
91
92
93
# File 'lib/dionysus/producer/registry.rb', line 89

def initialize(model_klass, options = {})
  @model_klass = model_klass
  @options = options
  validate_and_set_up
end

Instance Attribute Details

#model_klassObject (readonly)

Returns the value of attribute model_klass.



87
88
89
# File 'lib/dionysus/producer/registry.rb', line 87

def model_klass
  @model_klass
end

#optionsObject (readonly)

Returns the value of attribute options.



87
88
89
# File 'lib/dionysus/producer/registry.rb', line 87

def options
  @options
end

Instance Method Details

#association_name_for_observable(resource, changeset) ⇒ Object



99
100
101
# File 'lib/dionysus/producer/registry.rb', line 99

def association_name_for_observable(resource, changeset)
  observer_config_for(resource, changeset).fetch(:association_name)
end

#observables_configObject



103
104
105
# File 'lib/dionysus/producer/registry.rb', line 103

def observables_config
  options.fetch(:observe, [])
end

#observes?(resource, changeset) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/dionysus/producer/registry.rb', line 95

def observes?(resource, changeset)
  observer_config_for(resource, changeset).present?
end