Module: ActiveRecord::FullTextSearch

Defined in:
lib/active_record/full_text_search.rb,
lib/active_record/full_text_search/version.rb,
lib/active_record/full_text_search/command_recorder.rb,
lib/active_record/full_text_search/7.2/schema_dumper.rb,
lib/active_record/full_text_search/schema_statements.rb,
lib/active_record/full_text_search/7.2/postgresql_adapter.rb

Defined Under Namespace

Modules: CommandRecorder, PostgreSQLAdapter, SchemaDumper, SchemaStatements

Constant Summary collapse

KNOWN_VERSIONS =
%w[7.2 8.0 8.1].map { |v| Gem::Version.new(v) }.freeze
VERSION_DIRECTORIES =

Maps a supported version to the directory containing its implementation. Versions that share an implementation point to the same directory.

{
  Gem::Version.new("7.2") => "7.2",
  Gem::Version.new("8.0") => "7.2",
  Gem::Version.new("8.1") => "7.2",
}.freeze
VERSION =
"0.3.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.enabled_versionObject (readonly)

Returns the value of attribute enabled_version.



17
18
19
# File 'lib/active_record/full_text_search.rb', line 17

def enabled_version
  @enabled_version
end

Class Method Details

.detected_versionObject



36
37
38
# File 'lib/active_record/full_text_search.rb', line 36

def detected_version
  approximate_version Gem.loaded_specs["activerecord"].version
end

.install(version) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/active_record/full_text_search.rb', line 19

def install(version)
  @enabled_version = approximate_version(version)

  # Don't immediately fail if we don't yet support the current version.
  # There's at least a chance it could work.
  if !KNOWN_VERSIONS.include?(enabled_version) && enabled_version > KNOWN_VERSIONS.last
    @enabled_version = KNOWN_VERSIONS.last
    warn "[FullTextSearch] Current ActiveRecord version unsupported! Falling back to: #{enabled_version}"
  end

  initialize!
end

.register(patch, &block) ⇒ Object



32
33
34
# File 'lib/active_record/full_text_search.rb', line 32

def register(patch, &block)
  monkeypatches[patch] = block
end