21 lines
380 B
Ruby
21 lines
380 B
Ruby
# frozen_string_literal: true
|
|
|
|
class DiceRollType < ApplicationRecord
|
|
belongs_to :rollable, polymorphic: true
|
|
|
|
validates :name, length: { maximum: 100 }
|
|
validates :roll_command, length: { maximum: 100 }
|
|
|
|
def roll(table)
|
|
roller = DiceRoller.new(roll_command, stat: rollable)
|
|
end
|
|
|
|
def value
|
|
rollable.value
|
|
end
|
|
|
|
def character
|
|
rollable.character
|
|
end
|
|
end
|