Class: CalendarApi::BirthdayType
- Inherits:
-
Object
- Object
- CalendarApi::BirthdayType
- Defined in:
- lib/calendar_api/models/birthday_type.rb
Overview
Type of birthday or special event.
Constant Summary collapse
- BIRTHDAY_TYPE =
[ # TODO: Write general description for ANNIVERSARY ANNIVERSARY = 'anniversary'.freeze, # TODO: Write general description for BIRTHDAY BIRTHDAY = 'birthday'.freeze, # TODO: Write general description for CUSTOM CUSTOM = 'custom'.freeze, # TODO: Write general description for OTHER OTHER = 'other'.freeze, # TODO: Write general description for ENUM_SELF ENUM_SELF = 'self'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ANNIVERSARY) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/calendar_api/models/birthday_type.rb', line 32 def self.from_value(value, default_value = ANNIVERSARY) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'anniversary' then ANNIVERSARY when 'birthday' then BIRTHDAY when 'custom' then CUSTOM when 'other' then OTHER when 'enum_self' then ENUM_SELF else default_value end end |
.validate(value) ⇒ Object
26 27 28 29 30 |
# File 'lib/calendar_api/models/birthday_type.rb', line 26 def self.validate(value) return false if value.nil? BIRTHDAY_TYPE.include?(value) end |