Module: ExceptionNotifiable::ClassMethods
- Defined in:
- lib/exception_notifiable.rb
Instance Method Summary collapse
- #consider_local(*args) ⇒ Object
- #exception_data(deliverer = self) ⇒ Object
- #exceptions_to_treat_as_404 ⇒ Object
- #local_addresses ⇒ Object
Instance Method Details
#consider_local(*args) ⇒ Object
29 30 31 |
# File 'lib/exception_notifiable.rb', line 29 def consider_local(*args) local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) }) end |
#exception_data(deliverer = self) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/exception_notifiable.rb', line 42 def exception_data(deliverer=self) if deliverer == self read_inheritable_attribute(:exception_data) else write_inheritable_attribute(:exception_data, deliverer) end end |
#exceptions_to_treat_as_404 ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/exception_notifiable.rb', line 50 def exceptions_to_treat_as_404 exceptions = [ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction] exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError) exceptions end |
#local_addresses ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/exception_notifiable.rb', line 33 def local_addresses addresses = read_inheritable_attribute(:local_addresses) unless addresses addresses = [IPAddr.new("127.0.0.1")] write_inheritable_attribute(:local_addresses, addresses) end addresses end |