Class: OpenStax::RescueFrom::ExceptionOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/openstax/rescue_from/exception_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ExceptionOptions

Returns a new instance of ExceptionOptions.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/openstax/rescue_from/exception_options.rb', line 6

def initialize(options = {})
  options.stringify_keys!
  options = { 'notify' => true,
              'status' => :internal_server_error,
              'message' => nil,
              'sorry' => true,
              'extras' => ->(exception) { {} } }.merge(options)

  @notify = options['notify']
  @status_code = options['status']
  @message = options['message']
  @sorry = options['sorry']
  @extras = options['extras']
end

Instance Attribute Details

#extrasObject

Returns the value of attribute extras.



4
5
6
# File 'lib/openstax/rescue_from/exception_options.rb', line 4

def extras
  @extras
end

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/openstax/rescue_from/exception_options.rb', line 4

def message
  @message
end

#notifyObject

Returns the value of attribute notify.



4
5
6
# File 'lib/openstax/rescue_from/exception_options.rb', line 4

def notify
  @notify
end

#sorryObject

Returns the value of attribute sorry.



4
5
6
# File 'lib/openstax/rescue_from/exception_options.rb', line 4

def sorry
  @sorry
end

#status_codeObject

Returns the value of attribute status_code.



4
5
6
# File 'lib/openstax/rescue_from/exception_options.rb', line 4

def status_code
  @status_code
end

Instance Method Details

#notify?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/openstax/rescue_from/exception_options.rb', line 21

def notify?
  @notify
end