Class: JsonApiResponders::Config
- Inherits:
-
Object
- Object
- JsonApiResponders::Config
- Defined in:
- lib/json_api_responders/config.rb
Constant Summary collapse
- DEFAULT_RENDER_METHOD =
:json- RENDER_METHODS =
[:jsonapi, :json]
Instance Attribute Summary collapse
-
#required_options ⇒ Object
Returns the value of attribute required_options.
Instance Method Summary collapse
- #check_required_options(options) ⇒ Object
- #render_method ⇒ Object
- #render_method=(render_method) ⇒ Object
Instance Attribute Details
#required_options ⇒ Object
Returns the value of attribute required_options.
3 4 5 |
# File 'lib/json_api_responders/config.rb', line 3 def end |
Instance Method Details
#check_required_options(options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/json_api_responders/config.rb', line 11 def () return if .nil? || .empty? action = action() if action && .key?(action) [action].each do |key| raise JsonApiResponders::Errors::RequiredOptionMissingError, key unless .key? key end end end |
#render_method ⇒ Object
22 23 24 |
# File 'lib/json_api_responders/config.rb', line 22 def render_method @render_method || DEFAULT_RENDER_METHOD end |
#render_method=(render_method) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/json_api_responders/config.rb', line 26 def render_method=(render_method) if RENDER_METHODS.include?(render_method) @render_method = render_method else raise JsonApiResponders::Errors::InvalidRenderMethodError, render_method end end |