Class: Randsum::Dropper
- Inherits:
-
Object
- Object
- Randsum::Dropper
- Defined in:
- lib/randsum/filters/droppers/dropper.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#roll ⇒ Object
readonly
Returns the value of attribute roll.
Class Method Summary collapse
Instance Method Summary collapse
- #filter ⇒ Object
-
#initialize(quantity:, roll:) ⇒ Dropper
constructor
A new instance of Dropper.
- #ordered ⇒ Object
Constructor Details
#initialize(quantity:, roll:) ⇒ Dropper
Returns a new instance of Dropper.
11 12 13 14 |
# File 'lib/randsum/filters/droppers/dropper.rb', line 11 def initialize(quantity:, roll:) @quantity = quantity @roll = roll end |
Instance Attribute Details
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
3 4 5 |
# File 'lib/randsum/filters/droppers/dropper.rb', line 3 def quantity @quantity end |
#roll ⇒ Object (readonly)
Returns the value of attribute roll.
3 4 5 |
# File 'lib/randsum/filters/droppers/dropper.rb', line 3 def roll @roll end |
Class Method Details
.for(quantity:, extremity:, roll:) ⇒ Object
5 6 7 8 9 |
# File 'lib/randsum/filters/droppers/dropper.rb', line 5 def self.for(quantity:, extremity:, roll:) Object.const_get( "Randsum::#{extremity.to_s.gsub("est","").capitalize}Dropper" ).new(quantity: quantity, roll: roll) end |
Instance Method Details
#filter ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/randsum/filters/droppers/dropper.rb', line 16 def filter return Randsum::Roll.new( die: roll.die, quantity: roll.quantity, result: result ) end |
#ordered ⇒ Object
24 25 26 |
# File 'lib/randsum/filters/droppers/dropper.rb', line 24 def ordered raise NotImplementedError end |