Module: PgTagsOn

Defined in:
lib/pg_tags_on.rb,
lib/pg_tags_on/tag.rb,
lib/pg_tags_on/version.rb,
lib/pg_tags_on/repository.rb,
lib/pg_tags_on/tags_query.rb,
lib/pg_tags_on/predicate_handler.rb,
lib/pg_tags_on/active_record/arel.rb,
lib/pg_tags_on/active_record/base.rb,
lib/pg_tags_on/benchmark/benchmark.rb,
lib/pg_tags_on/validations/validator.rb,
lib/pg_tags_on/repositories/base_repository.rb,
lib/pg_tags_on/repositories/array_repository.rb,
lib/pg_tags_on/predicate_handler/base_handler.rb,
lib/pg_tags_on/repositories/array_jsonb/create.rb,
lib/pg_tags_on/repositories/array_jsonb/delete.rb,
lib/pg_tags_on/repositories/array_jsonb/update.rb,
lib/pg_tags_on/repositories/array_value/create.rb,
lib/pg_tags_on/repositories/array_value/delete.rb,
lib/pg_tags_on/repositories/array_value/update.rb,
lib/pg_tags_on/repositories/array_jsonb_repository.rb,
lib/pg_tags_on/predicate_handler/array_text_handler.rb,
lib/pg_tags_on/predicate_handler/array_jsonb_handler.rb,
lib/pg_tags_on/predicate_handler/array_string_handler.rb,
lib/pg_tags_on/predicate_handler/array_integer_handler.rb,
lib/pg_tags_on/predicate_handler/array_jsonb_with_attrs_handler.rb

Overview

PgTagsOn configuration methods

Defined Under Namespace

Modules: ActiveRecord, Repositories Classes: Benchmark, ColumnNotFoundError, Error, PredicateHandler, Repository, Tag, TagsQuery, TagsValidator

Constant Summary collapse

VERSION =
'1.0.1'

Class Method Summary collapse

Class Method Details

.configurationObject



41
42
43
# File 'lib/pg_tags_on.rb', line 41

def configuration
  @config || configure
end

.configure {|@config| ... } ⇒ Object

Yields:

  • (@config)


35
36
37
38
39
# File 'lib/pg_tags_on.rb', line 35

def configure
  @config ||= OpenStruct.new(query_class: 'Tags')
  yield @config if block_given?
  @config
end

.query_classObject



55
56
57
# File 'lib/pg_tags_on.rb', line 55

def query_class
  Kernel.const_get(PgTagsOn.configuration.query_class)
end

.query_class?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/pg_tags_on.rb', line 51

def query_class?
  Kernel.const_defined?(PgTagsOn.configuration.query_class)
end

.register_query_classObject



45
46
47
48
49
# File 'lib/pg_tags_on.rb', line 45

def register_query_class
  return true if query_class?

  Kernel.const_set(PgTagsOn.configuration.query_class.to_sym, PgTagsOn::TagsQuery)
end