Class: Rails::Surrender::Response
- Inherits:
-
Object
- Object
- Rails::Surrender::Response
- Defined in:
- lib/rails/surrender/response.rb
Overview
Generate a Response object from the given data
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data:) ⇒ Response
constructor
A new instance of Response.
- #json_data ⇒ Object
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
#data ⇒ Object
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_data ⇒ Object
13 14 15 |
# File 'lib/rails/surrender/response.rb', line 13 def json_data ::Oj.dump(data, mode: :compat) end |