Permalink
Browse files

update README and add LICENSE

  • Loading branch information...
1 parent 70bc5da commit 5975fd7a1c336b74c4e42feb5d9676b0a6b18cc5 @wmorgan committed Mar 13, 2012
Showing with 85 additions and 17 deletions.
  1. +24 −0 LICENSE
  2. +60 −16 README
  3. +1 −1 Rakefile
View
24 LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2011--2012 William Morgan.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
76 README
@@ -1,28 +1,72 @@
-LevelDB Ruby bindings.
+LevelDB is a very fast, persistent, in-process key-value store.
+Read more about it here: http://code.google.com/p/leveldb/.
-Do this:
+This gem contains Ruby bindings so that you can use it from your
+Ruby process.
- gem install leveldb-ruby
+INSTALLATION
+ gem install leveldb-ruby
-And then run this:
+SYNOPSIS
- require 'rubygems' # on ruby < 1.9
+ require 'rubygems' # on for ruby 1.8
require 'leveldb'
+ ## make a new database
db = LevelDB::DB.new "/tmp/asdf"
- db.put "it", "works"
- db.get "it"
-Only a very few operations are supported right now:
+ ## getting and setting
+ db.put "it", "works" # => "works"
+ db.get "it" # => "works"
+
+ db["hello"] = "there" # => "there"
+ db["hello"] # => "there"
+
+ db["nonexistent"] # => nil
+
+ ## testing
+ db.includes? "hello" # => true
+ db.contains? "hello" # => true
+
+ ## keys and values
+ db.keys # => "it", "hello"
+ db.values # => "there", "works"
+
+ ## iterating
+ db.each { |k, v| ... }
+ db.map { |k, v| ... }
+ db.each # => LevelDB::Iterator
+
+ ## ranges
+ db.each(:from => "a", :to => "b") # => LevelDB::Iterator
+ db.each(:from => "a", :to => "b").
+ map { |k, v| ... }
+ # etc...
+
+ ## deleting
+ db.delete "hello" # => "there"
+ db.delete "hello" # => nil
+
+LICENSE
+
+ Leveldb-ruby is available for your use under the terms of
+ the New BSD License. See the LICENSE file for details.
+
+CREDIT
+
+ This gem brought to you by William Morgan <http://masanjin.net/>
+ and the following honorable contributors:
+ - Rick Olson
+ - byplayer
+ - Yukio Goto
+ - Johannes Holzfuß
+ - Steve Wilhelm
+ - Gabriel Ebner
+ and by users like you.
+
+BUGS
- DB.new # creates or loads as necessary
- DB.create # dies if it already exists
- DB.load # dies unless it alread exists
+ Please report bugs to https://github.com/wmorgan/leveldb-ruby/issues.
- DB#get # alias: DB#[]
- DB#put # alias: DB#[]=
- DB#delete
- DB#each
- ... and all the enumerable methods
View
@@ -10,7 +10,7 @@ spec = Gem::Specification.new do |s|
s.authors = ["William Morgan"]
s.summary = "a Ruby binding to LevelDB"
s.homepage = "http://github.com/wmorgan/leveldb-ruby"
- s.files = %w(README ext/leveldb/extconf.rb ext/leveldb/platform.rb lib/leveldb.rb ext/leveldb/leveldb.cc leveldb/Makefile leveldb/build_detect_platform)
+ s.files = %w(README LICENSE ext/leveldb/extconf.rb ext/leveldb/platform.rb lib/leveldb.rb ext/leveldb/leveldb.cc leveldb/Makefile leveldb/build_detect_platform)
Find.find("leveldb") { |x| s.files += [x] if x =~ /\.(cc|h)$/}
s.extensions = %w(ext/leveldb/extconf.rb)
s.executables = []

0 comments on commit 5975fd7

Please sign in to comment.