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 = {})
@attributes = {}
@options = options
end
def create(target_object)
Attributes.new(
target_object,
attributes: @attributes,
options: @options
)
def add_attribute(name, adapter, &block)
adapter = coerce_adapter(adapter)
block.call(adapter) if block
@attributes[name.to_sym] = adapter
def coerce_adapter(adapter)
return adapter unless adapter.instance_of?(::Symbol)
Object.const_get("Koine::Attributes::Adapter::#{adapter.to_s.capitalize}").new