class SimpleEnumeration::Collections::CustomFactory
Attributes
collection_name[R]
enum_class[R]
types[R]
Public Class Methods
call(*params, **options, &block)
click to toggle source
# File lib/simple_enumeration/collections/custom_factory.rb, line 14 def self.call(*params, **options, &block) new(*params, **options).call(&block) end
new(enum_class:, collection_name:, types:)
click to toggle source
# File lib/simple_enumeration/collections/custom_factory.rb, line 8 def initialize(enum_class:, collection_name:, types:) @enum_class = enum_class @collection_name = collection_name @types = types end
Public Instance Methods
call()
click to toggle source
# File lib/simple_enumeration/collections/custom_factory.rb, line 18 def call collection = Collection.new(name: collection_name) CollectionMethodsDefiner.call(enum_class: enum_class, collection: collection) types.each do |type| collection.add_type(type.value, type) end collection end