lib/search.rb
def find_rows
    @matched_rows = @content.select do |obj|
      field_to_search = obj[@selected_field]
      field_to_search = field_to_search.join if field_to_search.is_a?(Array)
      field_to_search.to_s.split.join =~ /#{@field_value}/i
    end
    print_results
  end
# This method searches the pattern in JSON content
This method searches the pattern in JSON content
This method searches the pattern in JSON content
def find_rows
    @matched_rows = @content.select do |obj|
      field_to_search = obj[@selected_field]
      field_to_search = field_to_search.join if field_to_search.is_a?(Array)
      field_to_search.to_s.split.join =~ /#{@field_value}/i
    end
    print_results
  end
def find_rows @matched_rows = @content . select do | obj | field_to_search = obj [ @selected_field ] field_to_search = field_to_search . join if field_to_search . is_a? ( Array ) field_to_search . to_s . split . join =~ / #{ @field_value } /i end print_results end
This method searches the pattern in JSON content
This method searches the pattern in JSON content