class Fluent::Counter::Server::Response
Public Class Methods
new(errors = [], data = [])
click to toggle source
# File lib/fluent/counter/server.rb, line 234 def initialize(errors = [], data = []) @errors = errors @data = data end
Public Instance Methods
push_data(data)
click to toggle source
# File lib/fluent/counter/server.rb, line 243 def push_data(data) @data << data end
push_error(error)
click to toggle source
# File lib/fluent/counter/server.rb, line 239 def push_error(error) @errors << error end
to_hash()
click to toggle source
# File lib/fluent/counter/server.rb, line 247 def to_hash if @errors.empty? { 'data' => @data } else errors = @errors.map do |e| error = e.respond_to?(:to_hash) ? e : InternalServerError.new(e.to_s) error.to_hash end { 'data' => @data, 'errors' => errors } end end