Class: WixAnswers::Enumerations::Enumeration
- Inherits:
-
Object
- Object
- WixAnswers::Enumerations::Enumeration
show all
- Defined in:
- lib/wixanswers/enumerations.rb
Direct Known Subclasses
AgentChannel, AgentStatus, ArticleResolution, ArticleStatus, ArticleType, ArticleVersionPublicationStatus, AttachmentStatus, CallParticipantStatus, CallPriority, CallStatus, CallType, Channel, ChatMessageStatus, ChatMessageType, ChatParticipantStatus, ChatStatus, ContentTaskPriority, ContentTaskStatus, ContentTaskType, CounterType, EmailStatus, EventType, ItemType, Rating, ReplyStatus, ReplyType, SLAPolicyStatus, Satisfaction, SavedFilterContext, SavedFilterType, SavedReplyStatus, SearchType, TicketPriority, TicketStatus, UserType, WebhookType
Class Method Summary
collapse
Class Method Details
.by_values ⇒ Object
18
19
20
|
# File 'lib/wixanswers/enumerations.rb', line 18
def self.by_values
constants.map {|const| [const_get(const), const] }.to_h
end
|
.title(value) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/wixanswers/enumerations.rb', line 22
def self.title(value)
const_name = self.by_values[value]
return '' if const_name.nil?
const_name.to_s.capitalize.gsub(/\_/, ' ')
end
|
.valid?(value) ⇒ Boolean
10
11
12
|
# File 'lib/wixanswers/enumerations.rb', line 10
def self.valid?(value)
values.include?(value)
end
|
.validate!(value) ⇒ Object
14
15
16
|
# File 'lib/wixanswers/enumerations.rb', line 14
def self.validate!(value)
raise Exceptions::UnsupportedType.new(self.name, value) unless self.valid?(value)
end
|
.values ⇒ Object
6
7
8
|
# File 'lib/wixanswers/enumerations.rb', line 6
def self.values
Set.new(constants.map {|const| const_get(const) })
end
|