-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bd8dc72
Showing
11 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.gem | ||
*.swp | ||
*.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec | ||
|
||
gem 'murmurhash3' | ||
|
||
group :test do | ||
gem 'factory_girl' | ||
gem 'rspec' | ||
gem 'guard-rspec' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard :rspec do | ||
watch(%r{^spec/.+_spec\.rb$}) | ||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { "spec" } | ||
|
||
watch(%r{^spec/support/(.+)\.rb$}) { "spec" } | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Search redux | ||
|
||
A simpler wrapper around [murmurhash3](https://github.com/funny-falcon/murmurhash3-ruby) gem with a nicer API. | ||
|
||
## Requirements | ||
|
||
Murmur redux requires at least Ruby >= 1.9.2 | ||
|
||
## Installation | ||
|
||
Include the gem in your Gemfile: | ||
|
||
```ruby | ||
gem 'murmur_redux' | ||
``` | ||
|
||
## Quick start | ||
|
||
By default it uses MurmurHash3_x86_128 which is a nice combination of low latency and with good collision resistence. | ||
|
||
```ruby | ||
class MyClass | ||
hex_string = MurmurRedux::Hash.digest('test') | ||
end | ||
``` | ||
|
||
## License (MIT) | ||
|
||
Copyright (c) 2013 Marian Posaceanu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'search_redux/version' | ||
require 'search_redux/errors' | ||
require 'search_redux/helpers' | ||
require 'search_redux/glue' | ||
require 'search_redux/searchable' | ||
require 'search_redux/rdbms/mysql' | ||
require 'search_redux/rdbms/postgres' | ||
|
||
require 'search_redux/railtie' | ||
|
||
module SearchRedux | ||
extend Helpers | ||
|
||
module ClassMethods | ||
def act_as_searchable(options = {}) | ||
attr_accessor :searchable | ||
|
||
@searchable = SearchRedux::Searchable.new options | ||
end | ||
|
||
def text_search(query) | ||
raise(Errors::ActAsSearchableUnintialized, 'Use act_as_searchable') unless @searchable | ||
|
||
@searchable.full_text_search(query, self) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module MurmurRedux | ||
class Error < StandardError; end | ||
|
||
module Errors | ||
class NotFound < MurmurRedux::Error; end | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module MurmurRedux | ||
VERSION = '0.0.1' unless defined? MurmurRedux::VERSION | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
$LOAD_PATH.push File.expand_path("../lib", __FILE__) | ||
require 'murmur_redux/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = 'murmur_redux' | ||
s.version = MurmurRedux::VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.summary = 'A simpler wrapper around murmurhash3 gem with a nicer API.' | ||
s.author = 'Marian Posaceanu' | ||
s.email = '[email protected]' | ||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.require_paths = ['lib'] | ||
s.homepage = 'https://github.com/dakull/murmur_redux' | ||
|
||
s.required_ruby_version = '>= 1.9.2' | ||
|
||
s.add_dependency('murmurhash3', '~> 0.1.3') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file was generated by the `rspec --init` command. Conventionally, all | ||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. | ||
# Require this file using `require "spec_helper"` to ensure that it is only | ||
# loaded once. | ||
# | ||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration | ||
RSpec.configure do |config| | ||
config.treat_symbols_as_metadata_keys_with_true_values = true | ||
config.run_all_when_everything_filtered = true | ||
config.filter_run :focus | ||
|
||
# Run specs in random order to surface order dependencies. If you find an | ||
# order dependency and want to debug it, you can fix the order by providing | ||
# the seed, which is printed after each run. | ||
# --seed 1234 | ||
config.order = 'random' | ||
end |