Method: Megatron::ApplicationHelper#test_here_key_value

Defined in:
app/helpers/megatron/application_helper.rb

#test_here_key_value(key, value, check_params = params) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
# File 'app/helpers/megatron/application_helper.rb', line 73

def test_here_key_value(key, value, check_params = params)
  if value.is_a?(Hash)
    value.all? {|k,v| params[k].present? && test_here_key_value(k, v, params[k]) }
  elsif value.is_a?(Array)
    value.detect {|v| test_here_key_value(key, v) }.present?
  elsif value.is_a?(Regexp)
    (check_params[key] =~ value) != nil
  else
    value == check_params[key]
  end
end