Method: Jets::Router::MethodCreator::Code#url_method

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

#url_methodObject



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/jets/router/method_creator/code.rb', line 66

def url_method
  return if @as == :disabled
  path_method_call = "#{full_meth_name(:path)}#{meth_args}"
  # Note: It is important lazily get the value of ENV['JETS_HOST'] within the method.
  # Since it is not set until the request goes through the main middleware.
  <<~EOL
    def #{full_meth_name(:url)}#{meth_args}
      "\#{ENV['JETS_HOST']}\#{#{path_method_call}}"
    end
  EOL
end