Method: Onoma::NomenclatureSet#move_nomenclature

Defined in:
lib/onoma/nomenclature_set.rb

#move_nomenclature(old_name, new_name) ⇒ Object



125
126
127
128
129
130
131
132
133
# File 'lib/onoma/nomenclature_set.rb', line 125

def move_nomenclature(old_name, new_name)
  unless @nomenclatures[old_name]
    raise "Nomenclature #{old_name} does not exist"
  end
  raise "Nomenclature #{new_name} already exists" if @nomenclatures[new_name]

  @nomenclatures[new_name] = @nomenclatures.delete(old_name)
  @nomenclatures[new_name]
end