module WithEvents::Validator

Constants

DAILY_APPEARANCE
HOURLY_APPEARANCE

Public Instance Methods

valid_event?(event, appearance) click to toggle source
# File lib/with_events/validator.rb, line 8
def valid_event?(event, appearance)
  background_event?(event) &&
    valid_appearance?(event, appearance) &&
    valid_batch?(event)
end

Private Instance Methods

background_event?(event) click to toggle source
# File lib/with_events/validator.rb, line 20
def background_event?(event)
  event.options[:background]
end
valid_appearance?(event, appearance) click to toggle source
# File lib/with_events/validator.rb, line 24
def valid_appearance?(event, appearance)
  [HOURLY_APPEARANCE, DAILY_APPEARANCE]
    .include?(event.options[:appearance]) &&
    event.options[:appearance] == appearance.to_sym
end
valid_batch?(event) click to toggle source
# File lib/with_events/validator.rb, line 16
def valid_batch?(event)
  event.options[:batch].is_a?(Proc)
end