Skip to content

Commit

Permalink
use activesupport not unicode_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
eikes committed Oct 10, 2014
1 parent 6d9f2f8 commit 5d456f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion carmen.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Gem::Specification.new do |s|
s.add_development_dependency('nokogiri')
s.add_development_dependency('rake', '0.9.2.2')
s.add_development_dependency('debugger')
s.add_dependency('unicode_utils', '~> 1.4.0')
s.add_development_dependency('i18n')
s.add_dependency('activesupport', '~> 3.0.0')
end
6 changes: 3 additions & 3 deletions lib/carmen/querying.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'unicode_utils'
require 'active_support/core_ext/string'

module Carmen
module Querying
Expand Down Expand Up @@ -32,12 +32,12 @@ def coded(code)
def named(name, options={})
case_fold = !options[:case] && name.respond_to?(:each_codepoint)
# These only need to be built once
name = case_fold ? UnicodeUtils.casefold(name) : name
name = case_fold ? name.mb_chars.downcase.normalize : name
# For now, "fuzzy" just means substring, optionally case-insensitive (the second argument looks for nil, not falseness)
regexp = options[:fuzzy] ? Regexp.new(name, options[:case] ? nil : true) : nil

query_collection.find do |region|
found_literal = name === (case_fold && region.name ? UnicodeUtils.casefold(region.name) : region.name)
found_literal = name === (case_fold && region.name ? region.name.mb_chars.downcase.normalize : region.name)
found_literal || options[:fuzzy] && regexp === region.name
end
end
Expand Down

0 comments on commit 5d456f5

Please sign in to comment.