Module: Spree::Core::ControllerHelpers::RespondWith::ClassMethods Private
- Defined in:
- lib/spree/core/controller_helpers/respond_with.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #clear_overrides! ⇒ Object private
- #respond_override(options = {}) ⇒ Object private
Instance Method Details
#clear_overrides! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/spree/core/controller_helpers/respond_with.rb', line 34 def clear_overrides! self.spree_responders = {} end |
#respond_override(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/spree/core/controller_helpers/respond_with.rb', line 38 def respond_override( = {}) unless .blank? action_name = .keys.first action_value = .values.first if action_name.blank? || action_value.blank? raise ArgumentError, "invalid values supplied #{.inspect}" end format_name = action_value.keys.first format_value = action_value.values.first if format_name.blank? || format_value.blank? raise ArgumentError, "invalid values supplied #{.inspect}" end if format_value.is_a?(Proc) = { action_name.to_sym => { format_name.to_sym => { success: format_value } } } end spree_responders.deep_merge!(name.to_sym => ) end end |