Class: Lyra::ModelConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/lyra/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_class, options = {}) ⇒ ModelConfiguration

Returns a new instance of ModelConfiguration.



102
103
104
105
106
107
108
109
# File 'lib/lyra/configuration.rb', line 102

def initialize(model_class, options = {})
  @model_class = model_class
  @event_prefix = options[:event_prefix] || model_class.name
  @aggregate_class = options[:aggregate_class]
  @command_handler = options[:command_handler]
  @custom_event_mapping = options[:event_mapping] || {}
  @privacy_policy = options[:privacy_policy]
end

Instance Attribute Details

#aggregate_class ⇒ Object

Returns the value of attribute aggregate_class.



99
100
101
# File 'lib/lyra/configuration.rb', line 99

def aggregate_class
  @aggregate_class
end

#command_handler ⇒ Object

Returns the value of attribute command_handler.



99
100
101
# File 'lib/lyra/configuration.rb', line 99

def command_handler
  @command_handler
end

#event_prefix ⇒ Object

Returns the value of attribute event_prefix.



99
100
101
# File 'lib/lyra/configuration.rb', line 99

def event_prefix
  @event_prefix
end

#model_class ⇒ Object (readonly)

Returns the value of attribute model_class.



100
101
102
# File 'lib/lyra/configuration.rb', line 100

def model_class
  @model_class
end

#privacy_policy ⇒ Object

Returns the value of attribute privacy_policy.



99
100
101
# File 'lib/lyra/configuration.rb', line 99

def privacy_policy
  @privacy_policy
end

Instance Method Details

#event_name_for(operation) ⇒ Object



111
112
113
# File 'lib/lyra/configuration.rb', line 111

def event_name_for(operation)
  @custom_event_mapping[operation] || "#{event_prefix}#{operation.to_s.camelize}"
end