Class: FlagSettings

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFlagSettings

Returns a new instance of FlagSettings.



13
14
15
16
17
18
19
20
21
# File 'lib/flag_settings.rb', line 13

def initialize
  @all_flag_types = Enum.new
  @topic_flag_types = Enum.new
  @notify_types = Enum.new
  @auto_action_types = Enum.new
  @additional_message_types = Enum.new
  @without_additional_message_types = Enum.new
  @names = Enum.new
end

Instance Attribute Details

#additional_message_typesObject (readonly)

Returns the value of attribute additional_message_types.



4
5
6
# File 'lib/flag_settings.rb', line 4

def additional_message_types
  @additional_message_types
end

#auto_action_typesObject (readonly)

Returns the value of attribute auto_action_types.



4
5
6
# File 'lib/flag_settings.rb', line 4

def auto_action_types
  @auto_action_types
end

#notify_typesObject (readonly)

Returns the value of attribute notify_types.



4
5
6
# File 'lib/flag_settings.rb', line 4

def notify_types
  @notify_types
end

#topic_flag_typesObject (readonly)

Returns the value of attribute topic_flag_types.



4
5
6
# File 'lib/flag_settings.rb', line 4

def topic_flag_types
  @topic_flag_types
end

#without_additional_message_typesObject (readonly)

Returns the value of attribute without_additional_message_types.



4
5
6
# File 'lib/flag_settings.rb', line 4

def without_additional_message_types
  @without_additional_message_types
end

Instance Method Details

#add(id, name_key, topic_type: nil, notify_type: nil, auto_action_type: nil, require_message: nil, name: nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/flag_settings.rb', line 23

def add(
  id,
  name_key,
  topic_type: nil,
  notify_type: nil,
  auto_action_type: nil,
  require_message: nil,
  name: nil
)
  @all_flag_types[name_key] = id
  @topic_flag_types[name_key] = id if !!topic_type
  @notify_types[name_key] = id if !!notify_type
  @auto_action_types[name_key] = id if !!auto_action_type
  @names[id] = name if name

  if !!require_message
    @additional_message_types[name_key] = id
  else
    @without_additional_message_types[name_key] = id
  end
end

#flag_typesObject



49
50
51
# File 'lib/flag_settings.rb', line 49

def flag_types
  @all_flag_types
end

#is_flag?(key) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/flag_settings.rb', line 45

def is_flag?(key)
  @all_flag_types.valid?(key)
end