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.



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

def initialize
  @all_flag_types = Enum.new
  @topic_flag_types = Enum.new
  @notify_types = Enum.new
  @auto_action_types = Enum.new
  @custom_types = Enum.new
  @without_custom_types = Enum.new
end

Instance Attribute Details

#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_custom_typesObject (readonly)

Returns the value of attribute without_custom_types.



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

def without_custom_types
  @without_custom_types
end

Instance Method Details

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



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/flag_settings.rb', line 21

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

  if !!custom_type
    @custom_types[name] = id
  else
    @without_custom_types[name] = id
  end
end

#flag_typesObject



38
39
40
# File 'lib/flag_settings.rb', line 38

def flag_types
  @all_flag_types
end

#is_flag?(key) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/flag_settings.rb', line 34

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