lib/adequate_serialization/attribute.rb in adequate_serialization-1.0.0 vs lib/adequate_serialization/attribute.rb in adequate_serialization-1.0.1

- old
+ new

@@ -44,10 +44,14 @@ def initialize(attribute, condition) @attribute = attribute @condition = condition end + def name + attribute.name + end + def serialize_to(serializer, response, model, includes) return unless model.public_send(condition) attribute.serialize_to(serializer, response, model, includes) end @@ -59,10 +63,14 @@ def initialize(attribute, condition) @attribute = attribute @condition = condition end + def name + attribute.name + end + def serialize_to(serializer, response, model, includes) return if model.public_send(condition) attribute.serialize_to(serializer, response, model, includes) end @@ -71,9 +79,13 @@ class Optional attr_reader :attribute def initialize(attribute) @attribute = attribute + end + + def name + attribute.name end def serialize_to(serializer, response, model, includes) return unless includes.include?(attribute.name)