module Phlexi module Table class WrappedObject attr_reader :unwrapped, :index delegate :field, to: :as_display def initialize(object, index:, display_class:) @unwrapped = object @index = index @display_class = display_class end def identifier @identifier ||= Phlexi::Field.object_primary_key(unwrapped) || (index + 1) end def value_of(key) @unwrapped.try(key) end def as_display @as_display ||= @display_class.new(unwrapped) end end end end