Class: TicketLimit
- Inherits:
-
Object
- Object
- TicketLimit
- Includes:
- EnumField::DefineEnum
- Defined in:
- app/models/enums/ticket_limit.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
- #default? ⇒ Boolean
-
#initialize(code) ⇒ TicketLimit
constructor
A new instance of TicketLimit.
- #message ⇒ Object
- #new_customers? ⇒ Boolean
- #personal? ⇒ Boolean
- #returning? ⇒ Boolean
- #title ⇒ Object
Constructor Details
#initialize(code) ⇒ TicketLimit
Returns a new instance of TicketLimit.
8 9 10 |
# File 'app/models/enums/ticket_limit.rb', line 8 def initialize(code) @code = code.to_sym end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'app/models/enums/ticket_limit.rb', line 6 def code @code end |
Instance Method Details
#default? ⇒ Boolean
34 35 36 |
# File 'app/models/enums/ticket_limit.rb', line 34 def default? @code == :default end |
#message ⇒ Object
16 17 18 19 20 |
# File 'app/models/enums/ticket_limit.rb', line 16 def return if default? I18n.t(code, scope: [:ticket_limit, :message]) end |
#new_customers? ⇒ Boolean
22 23 24 |
# File 'app/models/enums/ticket_limit.rb', line 22 def new_customers? @code == :new_customers end |
#personal? ⇒ Boolean
30 31 32 |
# File 'app/models/enums/ticket_limit.rb', line 30 def personal? @code == :personal end |
#returning? ⇒ Boolean
26 27 28 |
# File 'app/models/enums/ticket_limit.rb', line 26 def returning? @code == :returning_customer end |
#title ⇒ Object
12 13 14 |
# File 'app/models/enums/ticket_limit.rb', line 12 def title I18n.t(code, scope: [:ticket_limit]) end |