Method: CyberarmEngine::Console#abbrev_search

Defined in:
lib/cyberarm_engine/console.rb

#abbrev_search(array, text) ⇒ Object



214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/cyberarm_engine/console.rb', line 214

def abbrev_search(array, text)
  return [] unless text.length.positive?

  list = []
  Abbrev.abbrev(array).each do |abbrev, value|
    next unless abbrev&.start_with?(text)

    list << value
  end

  list.uniq
end