module RailsCom::ActionController::Include

Public Instance Methods

valid_ivars() click to toggle source
# File lib/rails_com/action_controller/include.rb, line 19
def valid_ivars
  _except = _protected_ivars.to_a + [
    :@marked_for_same_origin_verification
  ]
  self.instance_variables - _except
end
whether_filter(filter) click to toggle source
# File lib/rails_com/action_controller/include.rb, line 4
def whether_filter(filter)
  callback = self.__callbacks[:process_action].find { |i| i.filter == filter.to_sym }
  return false unless callback

  _if = callback.instance_variable_get(:@if).map do |c|
    c.call(self)
  end

  _unless = callback.instance_variable_get(:@unless).map do |c|
    !c.call(self)
  end

  !(_if + _unless).uniq.include?(false)
end