Top Level Namespace
Defined Under Namespace
Modules: Actions, Culpa, CulpaHelpers Classes: Action, FileStreamer, RendererDescriber, Session
Constant Summary collapse
- CULPA_VERSION =
'2.1.1'.freeze
Instance Method Summary collapse
-
#json ⇒ Object
This renderer helps render a JSON.
-
#status ⇒ Object
This renderer helps to return a simple status code the client.
Instance Method Details
#json ⇒ Object
This renderer helps render a JSON. You can add a or_status: :status_code to the render json: … to render a status code if the passed object to render is nil.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/culpa/renderers/json.rb', line 7 describe_renderer :json do |, _envelope| if [:json] { format: :json, status: RETURN_CODES[[:status]] || 200, headers: { 'Content-Type' => 'application/json' }.merge([:headers]), object: [:json] } else { format: :status, headers: [:headers], status: RETURN_CODES[[:or_status]] } end end |
#status ⇒ Object
This renderer helps to return a simple status code the client
5 6 7 8 9 10 11 |
# File 'lib/culpa/renderers/status.rb', line 5 describe_renderer :status do |, _envelope| { format: :status, headers: [:headers], status: RETURN_CODES[[:status]] } end |