Class: ActiveRecord::Like::ScopeSpawners::LikeScopeSpawners::Rails71AndBelowSpawner

Inherits:
AbstractSpawner
  • Object
show all
Includes:
Shared::Rails7AndBelowSpawner
Defined in:
lib/active_record/like/scope_spawner.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from AbstractSpawner

#opts, #rest, #scope

Instance Method Summary collapse

Methods inherited from AbstractSpawner

#initialize, spawn

Constructor Details

This class inherits a constructor from ActiveRecord::Like::ScopeSpawners::LikeScopeSpawners::AbstractSpawner

Instance Method Details

#spawnObject

:nodoc:



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/active_record/like/scope_spawner.rb', line 108

def spawn
  opts.each do |k,v|
    if v.is_a?(Array) && v.empty?
      opts[k] = ''
    end
  end

  chain_node(Arel::Nodes::Matches) do |nodes|
    nodes.inject { |memo, node| Arel::Nodes::Or.new(memo, node) }
  end
end