murmur_redux 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f86efa1d0a92c333ab5119703d1be96f108cd342
4
+ data.tar.gz: c775a8a518c9d285a4919ef30843fc9b69116e7d
5
+ SHA512:
6
+ metadata.gz: 5da0aff8b1c40090d1d96144c53cf50347c3307753db3849c78f1a05b2498ab5bb86723e79a15b1b4f31cb6cbb05490c49ac88f160200795eb75f51fdc5a7199
7
+ data.tar.gz: 603bcefa464c6e311839c8365443ca2c13a29414c7c79c3515b892318980fc6bc2b098b8f3c79f76ae5b894f0599974d3162bbffdefb46379ad8aa4614ea5c5e
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ *.swp
3
+ *.lock
4
+ tmp/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ murmur-redux
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'rspec'
7
+ gem 'guard-rspec'
8
+ end
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Search redux
2
+
3
+ A simpler wrapper around [murmurhash3](https://github.com/funny-falcon/murmurhash3-ruby) gem with a nicer API.
4
+
5
+ ## Requirements
6
+
7
+ Murmur redux requires at least Ruby >= 1.9.2
8
+
9
+ ## Installation
10
+
11
+ Include the gem in your Gemfile:
12
+
13
+ ```ruby
14
+ gem 'murmur_redux'
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ By default it uses MurmurHash3_x86_128 which is a nice combination of low latency and with good collision resistence.
20
+
21
+ ```ruby
22
+ class MyClass
23
+ hex_string = MurmurRedux::Hash.digest('test')
24
+ end
25
+ ```
26
+
27
+ ## License (MIT)
28
+
29
+ Copyright (c) 2013 Marian Posaceanu
30
+
31
+ 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:
32
+
33
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
34
+
35
+ 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.
36
+
@@ -0,0 +1,6 @@
1
+ require 'murmurhash3'
2
+
3
+ require 'murmur_redux/version'
4
+ require 'murmur_redux/errors'
5
+ require 'murmur_redux/hash'
6
+
@@ -0,0 +1,7 @@
1
+ module MurmurRedux
2
+ class Error < StandardError; end
3
+
4
+ module Errors
5
+ class NotFound < MurmurRedux::Error; end
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ module MurmurRedux
2
+ class Hash
3
+ class << self
4
+ def digest(string)
5
+ ints = MurmurHash3::V128.str_hash(string)
6
+
7
+ gen_hex_string(ints)
8
+ end
9
+
10
+ private
11
+
12
+ def gen_hex_string(ints)
13
+ ints.pack('L*').unpack('H*').first
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module MurmurRedux
2
+ VERSION = '0.0.1' unless defined? MurmurRedux::VERSION
3
+ end
@@ -0,0 +1,20 @@
1
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
+ require 'murmur_redux/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'murmur_redux'
6
+ s.version = MurmurRedux::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.summary = 'A simple wrapper around murmurhash3 gem with a nicer API.'
9
+ s.description = 'A simple wrapper around murmurhash3 gem with a nicer API : MurmurRedux::Hash.digest(string)'
10
+ s.author = 'Marian Posaceanu'
11
+ s.email = 'contact@marianposaceanu.com'
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ s.require_paths = ['lib']
15
+ s.homepage = 'https://github.com/dakull/murmur_redux'
16
+
17
+ s.required_ruby_version = '>= 1.9.2'
18
+
19
+ s.add_dependency('murmurhash3', '~> 0.1.3')
20
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe MurmurRedux::Hash do
4
+ let(:string_to_digest) { 'Hello, world!' }
5
+
6
+ it 'digests an argument supplied string into a hexadecimal representation' do
7
+ digested_string = MurmurRedux::Hash.digest(string_to_digest)
8
+
9
+ expect(digested_string).should eq('df65d6d2d12d51f164c5f3a85066322c')
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ require 'murmur_redux'
2
+
3
+ RSpec.configure do |config|
4
+ config.treat_symbols_as_metadata_keys_with_true_values = true
5
+ config.run_all_when_everything_filtered = true
6
+ config.filter_run :focus
7
+
8
+ config.order = 'random'
9
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: murmur_redux
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marian Posaceanu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: murmurhash3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.3
27
+ description: 'A simple wrapper around murmurhash3 gem with a nicer API : MurmurRedux::Hash.digest(string)'
28
+ email: contact@marianposaceanu.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - .rspec
35
+ - .ruby-gemset
36
+ - .ruby-version
37
+ - Gemfile
38
+ - Guardfile
39
+ - README.md
40
+ - lib/murmur_redux.rb
41
+ - lib/murmur_redux/errors.rb
42
+ - lib/murmur_redux/hash.rb
43
+ - lib/murmur_redux/version.rb
44
+ - murmur_redux.gemspec
45
+ - spec/murmur_redux/hash_spec.rb
46
+ - spec/spec_helper.rb
47
+ homepage: https://github.com/dakull/murmur_redux
48
+ licenses: []
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: 1.9.2
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.0.0
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: A simple wrapper around murmurhash3 gem with a nicer API.
70
+ test_files: []