# frozen_string_literal: true class TicketLimit include EnumField::DefineEnum attr_reader :code def initialize(code) @code = code.to_sym end def title I18n.t(code, scope: [:ticket_limit]) end def message return if default? I18n.t(code, scope: [:ticket_limit, :message]) end def new_customers? @code == :new_customers end def returning? @code == :returning_customer end def personal? @code == :personal end def default? @code == :default end define_enum do |builder| builder.member :default, object: new(:default) builder.member :new_customers, object: new(:new_customers) builder.member :personal, object: new(:personal) builder.member :returning_customer, object: new(:returning_customer) end end