class Randsum::ReplacerTarget

Constants

ALL

Attributes

roll[R]
target[R]

Public Class Methods

for(target, roll:) click to toggle source
# File lib/randsum/filters/replacers/replacer_targets/replacer_target.rb, line 6
def self.for(target, roll:)
  case target
  when ALL
    ReplacerTargetAll
  when nil
    ReplacerTargetAll
  else
    ReplacerTarget
  end.new(target, roll: roll)
end
new(target, roll:) click to toggle source
# File lib/randsum/filters/replacers/replacer_targets/replacer_target.rb, line 17
def initialize(target, roll:)
  @target = target
  @roll = roll
end

Public Instance Methods

match() click to toggle source
# File lib/randsum/filters/replacers/replacer_targets/replacer_target.rb, line 22
def match
  roll.result.select do |r|
    r == target
  end
end