class Fzy::Hay(T)
- Fzy::Hay(T)
- Reference
- Object
Overview
A hay in haystack, where you try to find a needle.
Defined in:
fzy/hay.crConstructors
-
.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.
Instance Method Summary
-
#bonus : Array(Float32)
Match bonus, default to
Fzy.filepath_bonus
. -
#item : T
Reference to the item this Hay represents.
-
#key : String
key used to match, always in lower case.
-
#match?(downcase_needle : String, store_positions = false) : Match(T) | Nil
Returns a
Match(T)
if downcase_needle matches.
Constructor Detail
def self.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.
Instance Method Detail
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.