Class: Dogfood::Pool::CatView
- Inherits:
-
Object
- Object
- Dogfood::Pool::CatView
- Defined in:
- lib/dogfood/pool.rb
Overview
A scoped view of one category within a categorized pool.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(pool, category) ⇒ CatView
constructor
A new instance of CatView.
- #random(rng) ⇒ Object
Constructor Details
#initialize(pool, category) ⇒ CatView
Returns a new instance of CatView.
77 78 79 80 |
# File 'lib/dogfood/pool.rb', line 77 def initialize(pool, category) @pool = pool @category = category end |
Instance Method Details
#all ⇒ Object
86 87 88 |
# File 'lib/dogfood/pool.rb', line 86 def all @pool.send(:entries_for, @category) end |
#random(rng) ⇒ Object
82 83 84 |
# File 'lib/dogfood/pool.rb', line 82 def random(rng) rng.pick(@pool.send(:entries_for, @category)) end |