Class: Percentage::Chance
- Inherits:
-
Object
- Object
- Percentage::Chance
- Defined in:
- lib/alea/percentage.rb
Instance Attribute Summary collapse
-
#happens ⇒ Object
(also: #happens?)
readonly
Returns the value of attribute happens.
-
#odds ⇒ Object
readonly
Returns the value of attribute odds.
Instance Method Summary collapse
-
#initialize(percent) ⇒ Chance
constructor
A new instance of Chance.
- #of(&block) ⇒ Object
Constructor Details
Instance Attribute Details
#happens ⇒ Object (readonly) Also known as: happens?
Returns the value of attribute happens.
17 18 19 |
# File 'lib/alea/percentage.rb', line 17 def happens @happens end |
#odds ⇒ Object (readonly)
Returns the value of attribute odds.
17 18 19 |
# File 'lib/alea/percentage.rb', line 17 def odds @odds end |
Instance Method Details
#of(&block) ⇒ Object
25 26 27 |
# File 'lib/alea/percentage.rb', line 25 def of(&block) yield if happens? end |