Sha256: 8d7d124441c2fc066e76b1a629f1d2a2af7856e7a29e9c0a481e08e157751461
Contents?: true
Size: 518 Bytes
Versions: 3
Compression:
Stored size: 518 Bytes
Contents
require_relative 'association' module Alba # Representing one association class One < Association # Recursively converts an object into a Hash # # @param target [Object] the object having an association method # @param params [Hash] user-given Hash for arbitrary data # @return [Hash] def to_hash(target, params: {}) object = target.public_send(@name) object = @condition.call(object, params) if @condition @resource.new(object, params: params).to_hash end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alba-0.13.0 | lib/alba/one.rb |
alba-0.12.0 | lib/alba/one.rb |
alba-0.11.1 | lib/alba/one.rb |