Class: OptionsValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/pheromone/options_validator.rb

Overview

validate message options provided to publish method in Publishable concern

Constant Summary collapse

ACCEPTED_EVENT_TYPES =
i(create update).freeze

Instance Method Summary collapse

Constructor Details

#initialize(message_options) ⇒ OptionsValidator



6
7
8
9
# File 'lib/pheromone/options_validator.rb', line 6

def initialize(message_options)
  @errors = {}
  @message_options = message_options
end

Instance Method Details

#validateObject



11
12
13
14
15
16
17
18
# File 'lib/pheromone/options_validator.rb', line 11

def validate
  validate_message_options
  return @errors if @errors.present?
  validate_topic
  validate_event_types
  validate_message_attributes
  @errors
end