pzol/omnis — pull request #3 by pithyless (2013-01-15 14:52:51+00:00)
Title: Allow Operator to easily overwrite value parsing for subclassing

Sometimes you just want to modify how an Operator parses a value, and it is not very DRY to do it in blocks (especially if it is not specific to one class):

```ruby
class HotelSearch
include Omnis::MongoQuery

def self.parse_date(params, name)
value = params[name]
return nil if value.nil?
value = value.to_s.downcase.gsub(/[^\p{Word} ]/, '').split.join('\s.*')
Matches.new(name, value)
end

param(:name, Matches) {|params| self.matches_words(params, :name) }
param(:city, Matches) {|params| self.matches_words(params, :city) }
end
```

If Operator supports `::parse_value`, the common case is less verbose and reusable:

```ruby
class MatchesWords < Omnis::Operators::Matches
def parse_value(value)
return if value.nil?
value.to_s.downcase.gsub(/[^\p{Word} ]/, '').split.join('\s.*')
end
end

class HotelSearch
include Omnis::MongoQuery

param :name, MatchesWords
param :address, MatchesWords
end
```