class Identifiable::Stylist

Constants

VALID_STYLES

Public Class Methods

new(record:) click to toggle source
# File lib/identifiable/stylist.rb, line 7
def initialize(record:)
  @record = record
  @stylist = stylist
end

Public Instance Methods

random_id() click to toggle source
# File lib/identifiable/stylist.rb, line 12
def random_id
  @stylist.random_id
end

Private Instance Methods

stylist() click to toggle source
# File lib/identifiable/stylist.rb, line 18
def stylist
  case @record.class.identifiable_style
  when :numeric then Identifiable::Stylists::Numeric.new(record: @record)
  when :alphanumeric then Identifiable::Stylists::Alphanumeric.new(record: @record)
  when :uuid then Identifiable::Stylists::Uuid.new
  else
    raise Identifiable::Errors::StyleMustBeAValidStyle
  end
end