Sha256: 35fc31d2d0bdb47ead6ac8d8aedc0d28723ad7912aaba0d9a49f8285a76fcbe9

Contents?: true

Size: 404 Bytes

Versions: 3

Compression:

Stored size: 404 Bytes

Contents

module ActionPresenter
  module Defaults
    module Timestamps
      def created_at(format = :default)
        localize_time :created_at, format
      end

      def updated_at(format = :default)
        localize_time :updated_at, format
      end

    private

      def localize_time(time, format)
        I18n.l(object.try(time), format: format) if object.respond_to?(time)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
action_presenter-1.1.1 lib/action_presenter/defaults/timestamps.rb
action_presenter-1.1 lib/action_presenter/defaults/timestamps.rb
action_presenter-1.0.2 lib/action_presenter/defaults/timestamps.rb