Sha256: 63761a2ffe3883b295a80115d1bff2f0cea4a847abdc6206599a573589e698fa
Contents?: true
Size: 552 Bytes
Versions: 1
Compression:
Stored size: 552 Bytes
Contents
module Alba # Base class for `One` and `Many` # Child class should implement `to_hash` method class Association def initialize(name:, resource: nil, &block) @name = name @resource = resource @block = block raise ArgumentError, 'resource or block is required' if @resource.nil? && @block.nil? end def to_hash :not_implemented end private def resource_class klass = ::Alba::Resources::DefaultResource.dup klass.reset klass.class_eval(&@block) klass end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alba-0.9.0 | lib/alba/association.rb |