class Coppertone::ClassBuilder
Utility class for building class instances out of a set of registered types (e.g. mechanisms, modifiers)
Public Instance Methods
build(type, attributes)
click to toggle source
# File lib/coppertone/class_builder.rb, line 13 def build(type, attributes) return nil unless type klass = map[type] return nil unless klass klass.create(attributes) end
map()
click to toggle source
# File lib/coppertone/class_builder.rb, line 5 def map @map ||= {} end
register(type, klass)
click to toggle source
# File lib/coppertone/class_builder.rb, line 9 def register(type, klass) map[type] = klass end