class Rollr::RollReport
Attributes
roll[R]
Public Class Methods
new(roll)
click to toggle source
# File lib/rollr/roll_report.rb, line 4 def initialize(roll) @roll = roll end
Public Instance Methods
die()
click to toggle source
# File lib/rollr/roll_report.rb, line 16 def die roll.die end
drop(quantity:, extremity:)
click to toggle source
# File lib/rollr/roll_report.rb, line 32 def drop(quantity:, extremity:) return RollReport.new( roll.drop(quantity: quantity, extremity: extremity) ) end
drop_highest(quantity = 1)
click to toggle source
# File lib/rollr/roll_report.rb, line 44 def drop_highest(quantity = 1) return RollReport.new( roll.drop(quantity: quantity, extremity: :highest) ) end
drop_lowest(quantity = 1)
click to toggle source
# File lib/rollr/roll_report.rb, line 38 def drop_lowest(quantity = 1) return RollReport.new( roll.drop(quantity: quantity, extremity: :lowest) ) end
quantity()
click to toggle source
# File lib/rollr/roll_report.rb, line 28 def quantity @_quantity ||= rolls.count end
rolls()
click to toggle source
# File lib/rollr/roll_report.rb, line 20 def rolls @_rolls ||= roll.result end
sides()
click to toggle source
# File lib/rollr/roll_report.rb, line 12 def sides die.sides end
to_i()
click to toggle source
# File lib/rollr/roll_report.rb, line 8 def to_i total end
total()
click to toggle source
# File lib/rollr/roll_report.rb, line 24 def total @_total ||= rolls.inject(:+) end