Sha256: efe56065d2ff684001652c3b1fc9b7ed3297b71c3a07425122c0021a158cb1f6
Contents?: true
Size: 1.06 KB
Versions: 41
Compression:
Stored size: 1.06 KB
Contents
# These things required because camelize/constantize/classify methods are very slow module MotionPrime module HasClassFactory def class_factory(name, is_mp_class = false) if is_mp_class value = Prime.class_factory_cache["motion_prime/#{name}"] return value if value class_name = camelize_factory(name) return nil unless MotionPrime.const_defined?(class_name) class_name = "MotionPrime::#{class_name}" name = "motion_prime/#{name}" else value = Prime.class_factory_cache[name] return value if value class_name = camelize_factory(name) end Prime.class_factory_cache[name] = class_name.constantize end def camelize_factory(name) value = Prime.camelize_factory_cache[name] return value if value Prime.camelize_factory_cache[name] = name.camelize end def low_camelize_factory(name) value = Prime.low_camelize_factory_cache[name] return value if value Prime.low_camelize_factory_cache[name] = name.camelize(:lower) end end end
Version data entries
41 entries across 41 versions & 1 rubygems