class SimpleEnumeration::Collections::BasicFactory
Attributes
definitions[R]
enum_class[R]
Public Class Methods
call(*params, **options, &block)
click to toggle source
# File lib/simple_enumeration/collections/basic_factory.rb, line 13 def self.call(*params, **options, &block) new(*params, **options).call(&block) end
new(enum_class:, definitions:)
click to toggle source
# File lib/simple_enumeration/collections/basic_factory.rb, line 8 def initialize(enum_class:, definitions:) @enum_class = enum_class @definitions = definitions end
Public Instance Methods
call()
click to toggle source
# File lib/simple_enumeration/collections/basic_factory.rb, line 17 def call collection = Collection.new(name: :basic) CollectionMethodsDefiner.call(enum_class: enum_class, collection: collection) definitions.each do |definition| type = TypeBuilder.call(definition: definition, enum_class: enum_class) TypeMethodsDefiner.call(enum_class: enum_class, collection: collection, type: type) collection.add_type(type.value, type) end collection end