Module: Core::Endpoint::BasicHandler::Handlers
- Included in:
- Core::Endpoint::BasicHandler
- Defined in:
- app/api/core/endpoint/basic_handler/handlers.rb
Constant Summary collapse
- NullHandler =
Handler that behaves like it never deals with any URLs
Object.new.tap do |handler| %i[create read update delete].each do |action| handler.define_singleton_method(action) { |*_args| raise ::Core::Service::UnsupportedAction } end end
Instance Method Summary collapse
Instance Method Details
#actions(object, options) ⇒ Object
20 21 22 23 24 25 |
# File 'app/api/core/endpoint/basic_handler/handlers.rb', line 20 def actions(object, ) @handlers .select { |_name, handler| handler.is_a?(Core::Endpoint::BasicHandler::Actions::InnerAction) } .map { |_name, handler| handler.send(:actions, object, ) } .inject(super) { |actions, subactions| actions.merge(subactions) } end |
#initialize ⇒ Object
11 12 13 14 |
# File 'app/api/core/endpoint/basic_handler/handlers.rb', line 11 def initialize super @handlers = {} end |
#related ⇒ Object
16 17 18 |
# File 'app/api/core/endpoint/basic_handler/handlers.rb', line 16 def @handlers.map(&:last) end |