lib/alba/nested_attribute.rb in alba-2.2.0 vs lib/alba/nested_attribute.rb in alba-2.3.0

- old
+ new

@@ -6,14 +6,16 @@ def initialize(key_transformation: :none, &block) @key_transformation = key_transformation @block = block end - # @return [Hash] - def value(object) + # @param object [Object] the object being serialized + # @param params [Hash] params Hash inherited from Resource + # @return [Hash] hash serialized from running the class body in the object + def value(object:, params:) resource_class = Alba.resource_class resource_class.transform_keys(@key_transformation) resource_class.class_eval(&@block) - resource_class.new(object).serializable_hash + resource_class.new(object, params: params).serializable_hash end end end