Module: Pragma::Decorator::Timestamp

Defined in:
lib/pragma/decorator/timestamp.rb

Overview

Supports rendering timestamps as UNIX times.

Examples:

Rendering a timestamp as UNIX time

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

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

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



17
18
19
# File 'lib/pragma/decorator/timestamp.rb', line 17

def self.included(klass)
  klass.extend ClassMethods
end