module Nandi::Formatting::ClassMethods

Public Instance Methods

formatted_property(name) click to toggle source

Define an accessor method that will retrieve a value from a cell's model and format it with the format_value method below. @param name [String] the attribute on model to retrieve @example formatting the foo property

class MyCell < Cells::ViewModel
  include Nandi::Formatting

  formatted_property :foo
end
# File lib/nandi/formatting.rb, line 18
def formatted_property(name)
  define_method(name) do
    format_value(model.send(name))
  end
end