Class: Plutonium::UI::Display::Components::Currency

Inherits:
Phlexi::Display::Components::Base
  • Object
show all
Includes:
Phlexi::Display::Components::Concerns::DisplaysValue
Defined in:
lib/plutonium/ui/display/components/currency.rb

Overview

Renders a numeric value as currency (delimited, 2 decimals). No symbol by default; pass a literal ‘unit:` (“£”) or a Symbol read off the record (`unit: :currency_symbol`) for per-row currencies.

display :price, as: :currency
display :price, as: :currency, unit: "£"
display :price, as: :currency, unit: :currency_symbol

Instance Method Summary collapse

Instance Method Details

#render_value(value) ⇒ Object



19
20
21
# File 'lib/plutonium/ui/display/components/currency.rb', line 19

def render_value(value)
  p(**attributes) { format_currency(value) }
end