Class: Tabletop::Condition
- Inherits:
-
Object
- Object
- Tabletop::Condition
- Defined in:
- lib/tabletop/condition.rb
Overview
Stores a block to evaluate against a Pool
Instance Method Summary collapse
-
#initialize(&block) ⇒ Condition
constructor
A new instance of Condition.
-
#met_by?(pool) ⇒ Boolean
returns false if the stored block evaluates to false or nil, otherwise returns true.
Constructor Details
#initialize(&block) ⇒ Condition
Returns a new instance of Condition.
5 6 7 |
# File 'lib/tabletop/condition.rb', line 5 def initialize(&block) @test = block end |
Instance Method Details
#met_by?(pool) ⇒ Boolean
returns false if the stored block evaluates to false or nil, otherwise returns true
11 12 13 14 15 16 17 |
# File 'lib/tabletop/condition.rb', line 11 def met_by?(pool) if @test.call(pool) true else false end end |