Module: Glossarist::Utilities::Enum::InstanceMethods

Defined in:
lib/glossarist/utilities/enum/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#deselect_type(type_name, value) ⇒ Object



25
26
27
# File 'lib/glossarist/utilities/enum/instance_methods.rb', line 25

def deselect_type(type_name, value)
  selected_type[type_name].delete(value)
end

#select_type(type_name, values) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/glossarist/utilities/enum/instance_methods.rb', line 13

def select_type(type_name, values)
  values = if values.is_a?(Array)
             values
           else
             [values]
           end

  values.each do |value|
    select_type_value(type_name, value)
  end
end

#selected_typeObject



7
8
9
10
11
# File 'lib/glossarist/utilities/enum/instance_methods.rb', line 7

def selected_type
  initialize_selected_type if @selected_type.nil?

  @selected_type
end