Class: Searchgasm::Condition::BeginsWith

Inherits:
Base
  • Object
show all
Defined in:
lib/searchgasm/condition/begins_with.rb

Instance Attribute Summary

Attributes inherited from Base

#column, #klass

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

aliases_for_klass, comparable_column?, condition_name, #condition_name, #explicitly_set_value=, #explicitly_set_value?, ignore_blanks?, #initialize, #name, name_for_klass, #quote_column_name, #quote_table_name, #quoted_column_name, #quoted_table_name, #sanitize, string_column?, type_cast_value?, #value, #value=

Constructor Details

This class inherits a constructor from Searchgasm::Condition::Base

Class Method Details

.aliases_for_column(column) ⇒ Object



10
11
12
# File 'lib/searchgasm/condition/begins_with.rb', line 10

def aliases_for_column(column)
  ["#{column.name}_bw", "#{column.name}_sw", "#{column.name}_starts_with", "#{column.name}_start"]
end

.name_for_column(column) ⇒ Object



5
6
7
8
# File 'lib/searchgasm/condition/begins_with.rb', line 5

def name_for_column(column)
  return unless string_column?(column)
  super
end

Instance Method Details

#to_conditions(value) ⇒ Object



15
16
17
# File 'lib/searchgasm/condition/begins_with.rb', line 15

def to_conditions(value)
  ["#{quoted_table_name}.#{quoted_column_name} LIKE ?", "#{value}%"]
end