Class: Rails::Surrender::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/surrender/response.rb

Overview

Generate a Response object from the given data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:) ⇒ Response

Returns a new instance of Response.



9
10
11
# File 'lib/rails/surrender/response.rb', line 9

def initialize(data:)
  @data = data
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



7
8
9
# File 'lib/rails/surrender/response.rb', line 7

def data
  @data
end

Instance Method Details

#json_dataObject



13
14
15
# File 'lib/rails/surrender/response.rb', line 13

def json_data
  ::Oj.dump(data, mode: :compat)
end