Class: Foto::JsonDate
- Inherits:
-
Object
- Object
- Foto::JsonDate
- Defined in:
- lib/foto/json_date.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
Instance Method Summary collapse
-
#initialize(date) ⇒ JsonDate
constructor
A new instance of JsonDate.
- #to_json ⇒ Object
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
#date ⇒ Object
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_json ⇒ Object
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 |