Class: XmlImportType
- Inherits:
-
Object
- Object
- XmlImportType
- Includes:
- EnumField::DefineEnum
- Defined in:
- app/models/defaults/xml_import_type.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ XmlImportType
constructor
A new instance of XmlImportType.
- #title ⇒ Object
Constructor Details
#initialize(value) ⇒ XmlImportType
Returns a new instance of XmlImportType.
8 9 10 |
# File 'app/models/defaults/xml_import_type.rb', line 8 def initialize(value) @code = value.to_sym end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'app/models/defaults/xml_import_type.rb', line 6 def code @code end |
Class Method Details
.parse(value) ⇒ Object
16 17 18 19 20 |
# File 'app/models/defaults/xml_import_type.rb', line 16 def self.parse(value) return if value.blank? all.detect { |item| item.code == value.to_s.downcase } end |
Instance Method Details
#title ⇒ Object
12 13 14 |
# File 'app/models/defaults/xml_import_type.rb', line 12 def title I18n.t(@code, scope: [:xml_import, :type]) end |