6
7
8
9
10
11
12
13
|
# File 'lib/qrapi/utils/kartograph_optional_properties.rb', line 6
def build_properties(object, scope, *args)
scoped_properties = scope ? properties.filter_by_scope(scope) : properties
scoped_properties.each_with_object({}) do |property, mapped|
raise ArgumentError, "#{object} does not respond to #{property.name}, so we can't map it" unless object.respond_to?(property.name)
mapped[property.key] = property.value_for(object, scope) unless property.value_for(object, scope).nil? && property.optional?
end
end
|