Method: Jets::Router::MethodCreator#create_method

Defined in:
lib/jets/router/method_creator.rb

#create_method(action) ⇒ Object

Examples:

posts_path: path: 'posts'
admin_posts_path: prefix: 'admin', path: 'posts'
new_post_path


26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jets/router/method_creator.rb', line 26

def create_method(action)
  # Code eventually does this:
  #
  #     code = Jets::Router::MethodCreator::Edit.new
  #     def_meth code.path_method
  #
  class_name = "Jets::Router::MethodCreator::#{action.camelize}"
  klass = class_name.constantize # Index, Show, Edit, New
  code = klass.new(@options, @scope, @controller)

  def_meth(code.path_method) if code.path_method
  def_meth(code.url_method) if code.url_method
end