Class: Foto::JsonDate

Inherits:
Object
  • Object
show all
Defined in:
lib/foto/json_date.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date) ⇒ JsonDate

Returns a new instance of JsonDate.



4
5
6
# File 'lib/foto/json_date.rb', line 4

def initialize(date)
  @date = date
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



2
3
4
# File 'lib/foto/json_date.rb', line 2

def date
  @date
end

Instance Method Details

#to_jsonObject



8
9
10
11
12
# File 'lib/foto/json_date.rb', line 8

def to_json
  format = "\"\\/Date(%s)\\/\""
  seconds = date.to_i * 1000
  format % [seconds]
end