Class: Transmutation::Attribute Private

Inherits:
Field
  • Object
show all
Defined in:
lib/transmutation/attribute.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A plain attribute: either a block evaluated in the serializer's context, or a method sent to the serialized object.

Instance Attribute Summary

Attributes inherited from Field

#key, #name

Instance Method Summary collapse

Methods inherited from Field

#initialize, #render?

Constructor Details

This class inherits a constructor from Transmutation::Field

Instance Method Details

#value(serializer, _options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/transmutation/attribute.rb', line 9

def value(serializer, _options)
  block ? serializer.instance_exec(&block) : serializer.object.send(name)
end