class

Fzy::Hay(T)

Inherits Reference < Object

A hay in haystack, where you try to find a needle.

Constructors

new(item : T, key : String = item.to_s, bonus : Array(Float32) = Fzy.filepath_bonus(key)) forall T

Initializes a Hay with a key, a reference to a item and a match bonus.

Source

Instance methods

bonus

Match bonus, default to Fzy.filepath_bonus.

Source
item

Reference to the item this Hay represents.

Source
key

key used to match, always in lower case.

Source
match?(downcase_needle : String, store_positions = false) : Match(T) | Nil

Returns a Match(T) if downcase_needle matches.

To save some memory allocations the match doesn't save the matched character positions, to change that pass true to store_positions.

downcase_needle MUST be downcase for case insensitive search.

Source