lib/json_response.rb in json_response-1.0.0 vs lib/json_response.rb in json_response-1.0.1
- old
+ new
@@ -1,15 +1,18 @@
+require 'activesupport'
+
class JsonResponse
attr_reader :status
def initialize
@status = false
+ @data = {}
end
def serialize
- { :status => @status }.to_json
+ { :status => @status, :data => @data }.to_json
end
def to_js(callback)
"#{callback}(#{serialize});"
end
@@ -18,8 +21,12 @@
@status = true
end
def negative
@status = false
+ end
+
+ def append(key, value)
+ @data[key] = value
end
end