Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Readme fix

* v0.0.5
  • Loading branch information...
commit a317a9f92308b41c03948787964ab1afb6f97602 1 parent d32eac8
@fl00r authored
View
15 README.md
@@ -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 lib/pickup.rb
@@ -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
2  lib/pickup/version.rb
@@ -1,3 +1,3 @@
class Pickup
- VERSION = "0.0.4"
+ VERSION = "0.0.5"
end
View
2  spec/pickup/pickup_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.