Sha256: 7698c6cf0774158206562ee548e0515a9316a52dd092c31547e334dcd39781ec
Contents?: true
Size: 734 Bytes
Versions: 3
Compression:
Stored size: 734 Bytes
Contents
module Disposable class Twin class Composition include Disposable::Composition extend Uber::InheritableAttr inheritable_attr :twin_classes self.twin_classes = {} # this creates one Twin per composed. def self.property(name, options, &block) twin_classes[options[:on]] ||= Class.new(Twin) twin_classes[options[:on]].property(name, options, &block) map options[:on] => [[name]] # why is Composition::map so awkward? end # TODO: test and implement ::collection def initialize(composed) twins = {} composed.each { |name, model| twins[name] = self.class.twin_classes[name].new(model) } super(twins) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
disposable-0.0.9 | lib/disposable/twin/composition.rb |
disposable-0.0.8 | lib/disposable/twin/composition.rb |
disposable-0.0.7 | lib/disposable/twin/composition.rb |