app/models/analysis_script.rb
def make_safe_name(old)
    return old if old.blank?
    old = old.dup

    old = old.gsub(NEGATIVE_WHITELIST, '_')

    old = old.downcase

    # remove duplicates
    old = old.squeeze('_')

    # trim start and end chars
    if old[0] == '_'
      old = old[1..-1]
    end

    if old[-1] == '_'
      old = old[0..-2]
    end

    old
  end
# removes invalid characters, and replaces them with underscores
removes invalid characters, and replaces them with underscores
removes invalid characters and replaces them with underscores
def make_safe_name(old)
    return old if old.blank?
    old = old.dup
    old = old.gsub(NEGATIVE_WHITELIST, '_')
    old = old.downcase
    old = old.squeeze('_')
    if old[0] == '_'
      old = old[1..-1]
    end
    if old[-1] == '_'
      old = old[0..-2]
    end
    old
  end
def make_safe_name ( old ) return old if old . blank? old = old . dup old = old . gsub ( NEGATIVE_WHITELIST , '_' ) old = old . downcase old = old . squeeze ( '_' ) if old [ 0 ] == '_' old = old [ 1 .. - 1 ] end if old [ - 1 ] == '_' old = old [ 0 .. - 2 ] end old end
removes invalid characters, and replaces them with underscores
removes invalid characters and replaces them with underscores
# remove duplicates # trim start and end chars
old