Method: Steem::JSONable#as_json

Defined in:
lib/steem/mixins/jsonable.rb

#as_json(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/steem/mixins/jsonable.rb', line 17

def as_json options = {}
  serialized = Hash.new
  
  self.class.attributes.each do |attribute|
    unless (value = self.public_send attribute).nil?
      serialized[attribute] = if value.respond_to? :strftime
        value.strftime('%Y-%m-%dT%H:%M:%S')
      else
        value
      end
    end
  end
  
  serialized
end