Class: ReportType
- Inherits:
-
Object
- Object
- ReportType
- Includes:
- EnumField::DefineEnum
- Defined in:
- app/models/enums/report_type.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code) ⇒ ReportType
constructor
A new instance of ReportType.
Constructor Details
#initialize(code) ⇒ ReportType
Returns a new instance of ReportType.
8 9 10 |
# File 'app/models/enums/report_type.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/report_type.rb', line 6 def code @code end |
Class Method Details
.parse(value) ⇒ Object
12 13 14 15 16 |
# File 'app/models/enums/report_type.rb', line 12 def self.parse(value) return if value.blank? all.detect { |item| item.code.to_s == value.to_s.downcase } end |