Class: Lotus::Routing::Resource::CollectionAction Private

Inherits:
Action
  • Object
show all
Defined in:
lib/lotus/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 Lotus::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



287
288
289
290
291
292
293
# File 'lib/lotus/routing/resource/action.rb', line 287

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



282
283
284
# File 'lib/lotus/routing/resource/action.rb', line 282

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