Class: CalendarAssistant::LocationConfigValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/calendar_assistant/location_config_validator.rb

Defined Under Namespace

Classes: LocationConfigValidationException

Class Method Summary collapse

Class Method Details

.valid?(config) ⇒ Boolean

Returns:

  • (Boolean)

Raises:



7
8
9
10
11
12
13
# File 'lib/calendar_assistant/location_config_validator.rb', line 7

def self.valid?(config)
  return if (config.calendar_ids - [Config::DEFAULT_CALENDAR_ID]).empty?
  return if !!config[CalendarAssistant::Config::Keys::Settings::NICKNAME]
  return if !!config[CalendarAssistant::Config::Keys::Options::FORCE]

  raise LocationConfigValidationException, "Managing location across multiple calendars when a nickname is not set is not recommended, use --force to override"
end