Sha256: 199b85eeed7ad2bf267f129498fc29317f98acf489d8f7c213329947dc3ef690

Contents?: true

Size: 451 Bytes

Versions: 4

Compression:

Stored size: 451 Bytes

Contents

module RocketJobMissionControl
  module Jobs
    class Search
      attr_reader :results, :search_term

      def initialize(search_term, search_subset)
        @search_term = search_term
        @results     = search_subset
      end

      def execute
        if !search_term.blank?
          @results = @results.where('$or' => [{_type: /#{search_term}/i}, {description: /#{search_term}/i}])
        end
        @results
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rocketjob_mission_control-2.1.0 app/interactors/rocket_job_mission_control/jobs/search.rb
rocketjob_mission_control-2.0.0 app/interactors/rocket_job_mission_control/jobs/search.rb
rocketjob_mission_control-2.0.0.rc2 app/interactors/rocket_job_mission_control/jobs/search.rb
rocketjob_mission_control-2.0.0.rc1 app/interactors/rocket_job_mission_control/jobs/search.rb