Sha256: 3878301bcadd23ba6c3fd401cea32c38df7c97b7fc255245b3ef4a1db76c19af
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
module Wally class SearchFeatures def initialize lists_features @lists_features = lists_features end def find(query) results = [] @lists_features.features.each do |feature| result = SearchResult.new(feature) if feature["tags"] feature["tags"].each do |tag| if tag["name"].downcase.include? query[:query].downcase result.matched_feature = feature end end end if feature["name"].downcase.include? query[:query].downcase result.matched_feature = feature end if feature["elements"] result.matched_scenarios = feature["elements"].select do |element| if element["name"].downcase.include? query[:query].downcase true elsif element["steps"] element["steps"].any? do |step| step["name"].downcase.include? query[:query].downcase end elsif element["tags"] element["tags"].any? do |tag| tag["name"].downcase.include? query[:query].downcase end end end end if result.matches? results << result end end results end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wally-0.0.5 | lib/wally/search_features.rb |
wally-0.0.3 | lib/wally/search_features.rb |