for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
module Koine
module Attributes
class AttributesFactory
def initialize(options = {})
@adapters = {}
@options = options
end
def create(target_object)
Attributes.new(target_object, adapters: @adapters, options: @options)
def add_attribute(name, adapter, &block)
adapter = coerce_adapter(adapter)
yield(adapter) if block
@adapters[name.to_sym] = adapter.freeze
def coerce_adapter(adapter)
return adapter unless adapter.instance_of?(::Symbol)
Object.const_get("Koine::Attributes::Adapter::#{adapter.to_s.capitalize}").new
def freeze
super
@adapters.freeze
@options.freeze