Module: Avm::Instances::EntryKeys

Defined in:
lib/avm/instances/entry_keys.rb

Class Method Summary collapse

Class Method Details

.allObject



9
10
11
# File 'lib/avm/instances/entry_keys.rb', line 9

def all
  all_keys.to_a
end

.key_const_set(prefix, suffix) ⇒ Object



23
24
25
26
27
# File 'lib/avm/instances/entry_keys.rb', line 23

def key_const_set(prefix, suffix)
  key = [prefix, suffix].reject(&:blank?).join('.')
  const_set(key.gsub('.', '_').upcase, key)
  all_keys << key
end

.keys_consts_set(prefix, suffixes) ⇒ Object



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

def keys_consts_set(prefix, suffixes)
  if suffixes.is_a?(::Hash)
    keys_consts_set_from_hash(prefix, suffixes)
  elsif suffixes.is_a?(::Enumerable)
    keys_consts_set_from_enum(prefix, suffixes)
  else
    raise "Unmapped suffixes class: #{suffixes.class}"
  end
end