Sha256: cd1026e263e558699281abe38c7b86227cc116ff9e829dd9f077237c6dbf809a
Contents?: true
Size: 817 Bytes
Versions: 8
Compression:
Stored size: 817 Bytes
Contents
class SiteHub class Collection < Hash class DuplicateVersionException < Exception end module ClassMethods def overrides @overrides ||= [] end UNIQUE_LABELS_MSG = 'supply unique labels'.freeze def method_added(name) if name == :add && !overrides.include?(name) overrides << name alias_method :add_backup, :add send(:define_method, :add) do |id, value, *args| raise DuplicateVersionException, UNIQUE_LABELS_MSG if self[id] add_backup id, value, *args end end end end def valid? raise 'implement me' end def resolve raise 'implement me' end class << self def inherited(clazz) clazz.extend(ClassMethods) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems