Exception: RailsParam::InvalidParameterError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rails_param/invalid_parameter_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, param: nil, options: {}) ⇒ InvalidParameterError

Returns a new instance of InvalidParameterError.



5
6
7
8
9
# File 'lib/rails_param/invalid_parameter_error.rb', line 5

def initialize(message, param: nil, options: {})
  self.param = param
  self.options = options
  super(message)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/rails_param/invalid_parameter_error.rb', line 3

def options
  @options
end

#paramObject

Returns the value of attribute param.



3
4
5
# File 'lib/rails_param/invalid_parameter_error.rb', line 3

def param
  @param
end

Instance Method Details

#messageObject



11
12
13
14
15
# File 'lib/rails_param/invalid_parameter_error.rb', line 11

def message
  return options[:message] if options.is_a?(Hash) && options.key?(:message)

  super
end