Class: Dogfood::Pool::CatView

Inherits:
Object
  • Object
show all
Defined in:
lib/dogfood/pool.rb

Overview

A scoped view of one category within a categorized pool.

Instance Method Summary collapse

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

#allObject



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