Sha256: 3fc2b55e60c8cb538e4cc6193bd47966c33bd95c8e78ddec2b5d982a0a19737f
Contents?: true
Size: 547 Bytes
Versions: 1
Compression:
Stored size: 547 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 return if object.nil? @resource.new(object, params: params).to_hash end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alba-0.13.1 | lib/alba/one.rb |