class NRSER::Labs::Globlin
@todo document NRSER::Labs::Globlin
class.
Public Class Methods
new(split:, ignore: nil)
click to toggle source
Instantiate a new `NRSER:Globlin`.
# File lib/nrser/labs/globlin.rb, line 62 def initialize split:, ignore: nil @split = Array split end
Public Instance Methods
find_only!(search_string)
click to toggle source
# File lib/nrser/labs/globlin.rb, line 77 def find_only! search_string matcher = matcher_for search_string # Search entries that have the same seg count first found = @seg_count_index[matcher.seg_count].find_all_map { |entry| matcher.match entry } case found.length when 0 # move on.. when 1 return found[0] else raise TooManyError.new found end # Ok, try slice matches for entries with *more* segments only slice_matches = @seg_count_index.keys. select { |count| count > matcher.seg_count }. map { |key| @seg_count_index[key] }. reduce( :+ ). select { |entry| matcher.match_slice entry } end