class SearchCopGrammar::Attributes::Base

Attributes

attribute[R]
column_name[R]
field_names[R]
options[R]
table_alias[R]

Public Class Methods

new(klass, table_alias, column_name, field_names, options = {}) click to toggle source
# File lib/search_cop_grammar/attributes.rb, line 116
def initialize(klass, table_alias, column_name, field_names, options = {})
  @attribute = klass.arel_table.alias(table_alias)[column_name]
  @klass = klass
  @table_alias = table_alias
  @column_name = column_name
  @field_names = field_names
  @options = (options || {})
end

Public Instance Methods

compatible?(value) click to toggle source
# File lib/search_cop_grammar/attributes.rb, line 129
def compatible?(value)
  map value

  true
rescue SearchCop::IncompatibleDatatype
  false
end
fulltext?() click to toggle source
# File lib/search_cop_grammar/attributes.rb, line 137
def fulltext?
  false
end
map(value) click to toggle source
# File lib/search_cop_grammar/attributes.rb, line 125
def map(value)
  value
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/search_cop_grammar/attributes.rb, line 149
def method_missing(name, *args, &block)
  if @attribute.respond_to?(name)
    @attribute.send(name, *args, &block)
  else
    super
  end
end
respond_to_missing?(*args) click to toggle source
Calls superclass method
# File lib/search_cop_grammar/attributes.rb, line 157
def respond_to_missing?(*args)
  @attribute.respond_to?(*args) || super
end