Module: Pundit::Before::ClassMethods
- Defined in:
- lib/pundit/before.rb
Instance Method Summary collapse
- #_normalize_callback_option(options, from, to) ⇒ Object
- #_normalize_callback_options(options) ⇒ Object
- #before(*method_names, **options, &block) ⇒ Object
- #skip_before(*method_names, **options) ⇒ Object
Instance Method Details
#_normalize_callback_option(options, from, to) ⇒ Object
80 81 82 83 84 85 |
# File 'lib/pundit/before.rb', line 80 def _normalize_callback_option(, from, to) return unless (from = .delete(from)) from = CallbackFilter.new(from) [to] = Array([to]).unshift(from) end |
#_normalize_callback_options(options) ⇒ Object
75 76 77 78 |
# File 'lib/pundit/before.rb', line 75 def () _normalize_callback_option(, :only, :if) _normalize_callback_option(, :except, :unless) end |
#before(*method_names, **options, &block) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/pundit/before.rb', line 60 def before(*method_names, **, &block) () if block_given? set_callback :_pundit_before, :before, **, &block else set_callback :_pundit_before, :before, *method_names, ** end end |
#skip_before(*method_names, **options) ⇒ Object
70 71 72 73 |
# File 'lib/pundit/before.rb', line 70 def skip_before(*method_names, **) () skip_callback :_pundit_before, :before, *method_names, ** end |