Sha256: 68b38213199f7549ca4b87949d8ae81a8b570c9293115bed95e3383db0530c08
Contents?: true
Size: 713 Bytes
Versions: 2
Compression:
Stored size: 713 Bytes
Contents
require 'dicer/context/description' module Dicer class Context def self.descriptions @descriptions ||= self < Dicer::Context ? self.superclass.descriptions.dup : {} end def self.describe(klass, &block) description = Description.new(klass, &block) klass = description.described_class if descriptions.has_key?(klass) descriptions[klass].merge!(description) else descriptions[klass] = description end end def supply(object) description = self.class.descriptions[object.class] delegator = description ? description.delegator : nil delegator ? delegator.new(object) : object end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dicer-0.1.0 | lib/dicer/context.rb |
dicer-0.0.1 | lib/dicer/context.rb |