Exception: RailsSimpleParams::InvalidParameter

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rails_simple_params/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of InvalidParameter.



7
8
9
10
11
# File 'lib/rails_simple_params/exceptions.rb', line 7

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.



5
6
7
# File 'lib/rails_simple_params/exceptions.rb', line 5

def options
  @options
end

#paramObject

Returns the value of attribute param.



5
6
7
# File 'lib/rails_simple_params/exceptions.rb', line 5

def param
  @param
end

Instance Method Details

#messageObject



13
14
15
16
17
# File 'lib/rails_simple_params/exceptions.rb', line 13

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

  super
end