Permalink
Browse files

* Readme fix

* v0.0.5
  • Loading branch information...
1 parent d32eac8 commit a317a9f92308b41c03948787964ab1afb6f97602 @fl00r committed Jun 1, 2012
Showing with 19 additions and 4 deletions.
  1. +15 −0 README.md
  2. +2 −2 lib/pickup.rb
  3. +1 −1 lib/pickup/version.rb
  4. +1 −1 spec/pickup/pickup_spec.rb
View
@@ -67,6 +67,21 @@ pickup.pick
#=> "minnow"
```
+### Random uniq pick
+
+Also we can pick random uniq items from the list
+
+```ruby
+pickup = Pickup.new(pond, uniq: true)
+pickup.pick(3)
+#=> [ "gudgeon", "herring", "minnow" ]
+pickup.pick
+#=> "herring"
+pickup.pick
+#=> "gudgeon"
+pickup.pick
+#=> "sturgeon"
+```
## Contributing
View
@@ -4,9 +4,9 @@ class Pickup
attr_reader :list, :uniq
attr_writer :pick_func
- def initialize(list, uniq=false, &block)
+ def initialize(list, opts={}, &block)
@list = list
- @uniq = uniq
+ @uniq = opts[:uniq] || false
@pick_func = block if block_given?
end
View
@@ -1,3 +1,3 @@
class Pickup
- VERSION = "0.0.4"
+ VERSION = "0.0.5"
end
@@ -14,7 +14,7 @@
}
@func = Proc.new{ |a| a }
@pickup = Pickup.new(@list)
- @pickup2 = Pickup.new(@list, true)
+ @pickup2 = Pickup.new(@list, uniq: true)
end
it "should pick correct ammount of items" do

0 comments on commit a317a9f

Please sign in to comment.