lib/onoma/nomenclature.rb
# Add an item to the nomenclature
Add an item to the nomenclature
Add an item to the nomenclature
def change_item(name, changes = {})
      i = find!(name)
      has_parent = changes.key?(:parent)
      new_parent = changes[:parent]
      new_name = changes[:name]
      changes.each do |k, v|
        next if %i[parent name].include? k
        i.set(k, v)
      end
      if has_parent
        @roots << i if i.parent? && new_parent.nil?
        @roots.delete(i) if i.root? && new_parent
        i.parent = new_parent
      end
      i = rename_item(name, new_name) if new_name
      i
    end
def change_item ( name , changes = { } ) i = find! ( name ) has_parent = changes . key? ( :parent ) new_parent = changes [ :parent ] new_name = changes [ :name ] changes . each do | k , v | next if %i[ parent name ] . include? k i . set ( k , v ) end if has_parent @roots << i if i . parent? && new_parent . nil? @roots . delete ( i ) if i . root? && new_parent i . parent = new_parent end i = rename_item ( name , new_name ) if new_name i end
Add an item to the nomenclature
Add an item to the nomenclature
name
<not_specific>
changes
<not_specific>