Class: Cyrax::Base
- Inherits:
-
Object
- Object
- Cyrax::Base
- Includes:
- Extensions::HasResponse, HasActiveLogger::Mixin
- Defined in:
- lib/cyrax/base.rb
Direct Known Subclasses
Constant Summary
Constants included from Extensions::HasResponse
Extensions::HasResponse::STATUS_VALUES
Instance Attribute Summary collapse
-
#accessor ⇒ Object
Returns the value of attribute accessor.
-
#options ⇒ Object
Returns the value of attribute options.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
Creates a new Cyrax resource.
- #wrap_params(params) ⇒ Object
Methods included from Extensions::HasResponse
#add_error, #add_error_unless, #assign_resource, #assignment, #reset_errors, #respond_with, #response_name, #set_message, #set_status, #sync_errors_with, #sync_errors_with?
Constructor Details
#initialize(options = {}) ⇒ Base
Creates a new Cyrax resource
18 19 20 21 22 |
# File 'lib/cyrax/base.rb', line 18 def initialize( = {}) @accessor = [:as] @params = wrap_params([:params]) @options = end |
Instance Attribute Details
#accessor ⇒ Object
Returns the value of attribute accessor.
6 7 8 |
# File 'lib/cyrax/base.rb', line 6 def accessor @accessor end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/cyrax/base.rb', line 6 def @options end |
#params ⇒ Object
Returns the value of attribute params.
6 7 8 |
# File 'lib/cyrax/base.rb', line 6 def params @params end |
Instance Method Details
#wrap_params(params) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/cyrax/base.rb', line 24 def wrap_params(params) if Cyrax.strong_parameters && defined?(ActionController) && !params.is_a?(ActionController::Parameters) ActionController::Parameters.new(params) else params end end |