Sha256: c78d5784766bd886aac7d0762bf9a12edcee6a918833b8fc0eaecb11161e07a3
Contents?: true
Size: 600 Bytes
Versions: 5
Compression:
Stored size: 600 Bytes
Contents
class StaticTextFormatter def initialize(object) @object = object @columns = @object.class.columns.index_by(&:name).with_indifferent_access end def format(method) method_value = @object.send(method) if method_value if @columns[method] method_type = @columns[method].type if method_type == :datetime method_value = method_value.localtime if method_value.respond_to?(:localtime) Russian.strftime(method_value, '%d.%m.%Y %H:%M') else method_value end else method_value end end end end
Version data entries
5 entries across 5 versions & 1 rubygems