Class: Hanami::Routing::Resource::CollectionAction Private

Inherits:
Action
  • Object
show all
Defined in:
lib/hanami/routing/resource/action.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Collection action It implements #collection within a #resource block.

See Also:

Since:

  • 0.1.0

Constant Summary

Constants inherited from Action

Action::NESTED_ROUTES_SEPARATOR

Instance Method Summary collapse

Methods inherited from Action

generate, #initialize, #namespace, #resource_name

Constructor Details

This class inherits a constructor from Hanami::Routing::Resource::Action

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object (protected)

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.

Since:

  • 0.1.0


292
293
294
295
296
297
298
# File 'lib/hanami/routing/resource/action.rb', line 292

def method_missing(m, *args)
  verb        = m
  action_name = Utils::PathPrefix.new(args.first).relative_join(nil)

  @router.__send__ verb, path(action_name),
    to: endpoint(action_name), as: as(action_name)
end

Instance Method Details

#generate(&blk) ⇒ 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.

Since:

  • 0.1.0


285
286
287
# File 'lib/hanami/routing/resource/action.rb', line 285

def generate(&blk)
  instance_eval(&blk) if block_given?
end