class SimpleEnumeration::Entity
Attributes
converted_value[R]
Public Class Methods
define_basic_collection(*definitions)
click to toggle source
# File lib/simple_enumeration/entity.rb, line 18 def self.define_basic_collection(*definitions) Collections::BasicFactory.call( enum_class: self, definitions: definitions ) end
define_custom_collection(collection_name, *types)
click to toggle source
# File lib/simple_enumeration/entity.rb, line 25 def self.define_custom_collection(collection_name, *types) Collections::CustomFactory.call( enum_class: self, collection_name: collection_name, types: types ) end
get_collection(name)
click to toggle source
# File lib/simple_enumeration/entity.rb, line 33 def self.get_collection(name) instance_variable_get("@#{name}") end
i18n_scope()
click to toggle source
# File lib/simple_enumeration/entity.rb, line 11 def self.i18n_scope [ 'simple_enumeration', SimpleEnumeration.underscore(name.gsub('Enumeration', '')) ].join('.') end
new(converted_value:)
click to toggle source
# File lib/simple_enumeration/entity.rb, line 7 def initialize(converted_value:) @converted_value = converted_value end
set_collection(name, value)
click to toggle source
# File lib/simple_enumeration/entity.rb, line 37 def self.set_collection(name, value) instance_variable_set("@#{name}", value) end
Public Instance Methods
type()
click to toggle source
# File lib/simple_enumeration/entity.rb, line 41 def type @type ||= self.class.basic_collection.types.values.find do |type| type.converted_value.to_s == converted_value.to_s end end