class DataMapper::Query::Conditions::LikeComparison

Tests whether the value in the record is like the expected set for the Comparison. Equivalent to a LIKE clause in an SQL database.

TODO: move this to dm-more with DataObjectsAdapter plugins

Private Instance Methods

comparator_string() click to toggle source

@return [String]

@see DataMapper::Query::Conditions::AbstractComparison#to_s

@api private

# File lib/dm-core/query/conditions/comparison.rb, line 781
def comparator_string
  'LIKE'
end
expected() click to toggle source

Overloads the expected method in AbstractComparison

Return a regular expression suitable for matching against the records value.

@return [Regexp]

@see AbtractComparison#expected

@api semipublic

# File lib/dm-core/query/conditions/comparison.rb, line 772
def expected
  Regexp.new('\A' << super.gsub('%', '.*').tr('_', '.') << '\z')
end