Module: Brainshell::ValueFormatter

Included in:
Commands::Base
Defined in:
lib/brainshell/value_formatter.rb

Constant Summary collapse

KNOWN_FORMAT_METHODS =
{
    BigDecimal => :big_decimal,
    DateTime => :date_time
}.freeze

Instance Method Summary collapse

Instance Method Details

#format_value(value) ⇒ Object



9
10
11
12
# File 'lib/brainshell/value_formatter.rb', line 9

def format_value(value)
  format_method = KNOWN_FORMAT_METHODS[value.class]
  format_method ? send(format_method, value) : value
end