Slide 18
Slide 18 text
Patterns
&
Conventions
236 results - 109 files
actioncable/lib/action_cable/connection/tagged_logger_proxy.rb:
35 %i( debug info warn error fatal unknown ).each do |severity|
36: define_method(severity) do |message = nil, &block|
37 log severity, message, &block
actionpack/lib/abstract_controller/callbacks.rb:
230 [:before, :after, :around].each do |callback|
231: define_method "#{callback}_action" do |*names, &blk|
232 _insert_callbacks(names, blk) do |name, options|
236
237: define_method "prepend_#{callback}_action" do |*names, &blk|
238 _insert_callbacks(names, blk) do |name, options|
244 # the allowed parameters.
245: define_method "skip_#{callback}_action" do |*names|
246 _insert_callbacks(names) do |name, options|
actionpack/lib/abstract_controller/railties/routes_helpers.rb:
11 Module.new do
12: define_method(:inherited) do |klass|
13 super(klass)
actionpack/lib/action_controller/metal/flash.rb:
37
38: define_method(type) do
39 request.flash[type]
actionpack/lib/action_controller/metal/renderers.rb:
75 def self.add(key, &block)
76: define_method(_render_with_renderer_method_name(key), &block)
77 RENDERERS << key.to_sym
actionpack/lib/action_dispatch/http/content_security_policy.rb:
187 DIRECTIVES.each do |name, directive|
188: define_method(name) do |*sources|
189 if sources.first
actionpack/lib/action_dispatch/http/permissions_policy.rb:
122 DIRECTIVES.each do |name, directive|
123: define_method(name) do |*sources|
124 if sources.first
actionpack/lib/action_dispatch/routing/mapper.rb:
710
711: define_method :find_script_name do |options|
712 if options.key?(:script_name) && options[:script_name].present?
actionpack/lib/action_dispatch/routing/route_set.rb:
335 def define_url_helper(mod, name, helper, url_strategy)
336: mod.define_method(name) do |*args|
337 last = args.last
517 MountedHelpers.class_eval do
518: define_method "_#{name}" do
519 RoutesProxy.new(routes, _routes_context, helpers, script_namer)
616 # extra conveniences for working with @_routes.
617: define_method(:_routes) { @_routes || routes }