Class: Plutonium::UI::Display::Components::FormattedValue

Inherits:
Phlexi::Display::Components::String
  • Object
show all
Defined in:
lib/plutonium/ui/display/components/formatted_value.rb

Overview

Renders a value transformed by a user-supplied formatter: proc, themed like a plain string. formatter: is a general column/display option, but only the string component ever consumed it — handed to a typed component (boolean pill, currency, badge…) the Proc leaked into the element's HTML attributes and Phlex rejected it. The resource/table render layers route every formatter-bearing field here instead.

Unlike Phlexi's String component — which stringifies the value before the formatter runs (so a boolean false would arrive as the truthy string "false") — this keeps the raw value, matching the documented contract that a formatter "receives just the value".

Instance Method Summary collapse

Instance Method Details

#normalize_value(value) ⇒ Object

Keep the raw value so the formatter sees a real boolean / number / object rather than its to_s.



21
# File 'lib/plutonium/ui/display/components/formatted_value.rb', line 21

def normalize_value(value) = value