module Pragma::Decorator::Timestamp

Supports rendering timestamps as UNIX times.

@example Rendering a timestamp as UNIX time

class ArticleDecorator < Pragma::Decorator::Base
  timestamp :created_at
end

# {
#   "created_at": 1515250106
# }
ArticleDecorator.new(article).to_hash

Public Class Methods

included(klass) click to toggle source
# File lib/pragma/decorator/timestamp.rb, line 17
def self.included(klass)
  klass.extend ClassMethods
end